From gordonp at dev.open-bio.org Tue Jul 3 10:32:39 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 3 Jul 2007 10:32:39 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707031432.l63EWdQK022021@dev.open-bio.org> gordonp Tue Jul 3 10:32:39 EDT 2007 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv21986/docs Modified Files: DataPackageInAnger.html Log Message: Updated Seahawk JAR link moby-live/Java/docs DataPackageInAnger.html,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2007/01/19 18:32:36 1.3 +++ /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2007/07/03 14:32:39 1.4 @@ -43,7 +43,7 @@

The code library

You could get the whole jMOBY CVS source, including its library dependencies, or you can - simply use the JAR file (~2.7MB) + simply use the JAR file (~4MB) for the Seahawk client. It is self-contained, and sufficient to do any processing you will require to call MOBY services and MOBY Central. From kawas at dev.open-bio.org Thu Jul 5 13:31:46 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:31:46 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051731.l65HVkoi028848@dev.open-bio.org> kawas Thu Jul 5 13:31:45 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates In directory dev.open-bio.org:/tmp/cvs-serv28813/RDF/Predicates Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates added to the repository moby-live/Perl/MOBY/RDF/Predicates - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/RCS/directory,v: No such file or directory From kawas at dev.open-bio.org Thu Jul 5 13:31:48 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:31:48 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051731.l65HVm5d028902@dev.open-bio.org> kawas Thu Jul 5 13:31:48 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates In directory dev.open-bio.org:/tmp/cvs-serv28871/RDF/Predicates Added Files: OMG_LSID.pm RDFS.pm MOBY_PREDICATES.pm RDF.pm OWL.pm DC_PROTEGE.pm FETA.pm Log Message: initial commit of rdf vocab that is used... moby-live/Perl/MOBY/RDF/Predicates OMG_LSID.pm,NONE,1.1 RDFS.pm,NONE,1.1 MOBY_PREDICATES.pm,NONE,1.1 RDF.pm,NONE,1.1 OWL.pm,NONE,1.1 DC_PROTEGE.pm,NONE,1.1 FETA.pm,NONE,1.1 From kawas at dev.open-bio.org Thu Jul 5 13:38:22 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:38:22 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051738.l65HcMAa028946@dev.open-bio.org> kawas Thu Jul 5 13:38:22 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv28912/RDF/Ontologies Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies added to the repository moby-live/Perl/MOBY/RDF/Ontologies - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/RCS/directory,v: No such file or directory From kawas at dev.open-bio.org Thu Jul 5 13:38:26 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:38:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051738.l65HcQQg029000@dev.open-bio.org> kawas Thu Jul 5 13:38:26 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv28969/RDF/Ontologies Added Files: Objects.pm Namespaces.pm Services.pm ServiceTypes.pm Log Message: initlal commit of RDF generating code. TODO: URIs still have to be retrieved from mobycentral.config file LibXML::XSLT and RDF::Core are required libraries isAlive for service instances not added yet This is still a work in progress! moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,NONE,1.1 Namespaces.pm,NONE,1.1 Services.pm,NONE,1.1 ServiceTypes.pm,NONE,1.1 From kawas at dev.open-bio.org Thu Jul 5 13:39:02 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:39:02 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051739.l65Hd2lg029054@dev.open-bio.org> kawas Thu Jul 5 13:39:02 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv29023/RDF Added Files: Utils.pm Log Message: a module that should be updated to include sub routines that RDF generating code will find useful moby-live/Perl/MOBY/RDF Utils.pm,NONE,1.1 From kawas at dev.open-bio.org Fri Jul 6 11:02:19 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 6 Jul 2007 11:02:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707061502.l66F2Jgf002533@dev.open-bio.org> kawas Fri Jul 6 11:02:18 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv2495/RDF Modified Files: Utils.pm Log Message: removed dependency on LibXSLT for the time being moby-live/Perl/MOBY/RDF Utils.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/07/05 17:39:02 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/07/06 15:02:18 1.2 @@ -9,7 +9,7 @@ package MOBY::RDF::Utils; use XML::LibXML; -use XML::LibXSLT; +#use XML::LibXSLT; use strict; @@ -97,13 +97,14 @@ END } my $parser = XML::LibXML->new(); - my $xslt = XML::LibXSLT->new(); +# my $xslt = XML::LibXSLT->new(); my $source = $parser->parse_string($xml); - my $style_doc = $parser->parse_string( $self->{xslt} ); - my $stylesheet = $xslt->parse_stylesheet($style_doc); - my $results = $stylesheet->transform($source); - $xml = $stylesheet->output_string($results); - return '' . $xml; +# my $style_doc = $parser->parse_string( $self->{xslt} ); +# my $stylesheet = $xslt->parse_stylesheet($style_doc); +# my $results = $stylesheet->transform($source); +# $xml = $stylesheet->output_string($results); + $xml = $source->toString(0); + return $xml; } 1; From gordonp at dev.open-bio.org Fri Jul 6 18:06:51 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 6 Jul 2007 18:06:51 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707062206.l66M6peX019854@dev.open-bio.org> gordonp Fri Jul 6 18:06:51 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv19819/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java Log Message: Made doc on meaning of the class to MOBY clearer moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/06/09 18:12:52 1.16 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/07/06 22:06:51 1.17 @@ -14,6 +14,12 @@ import org.biomoby.shared.parser.MobyTags; /** + * This is the class that represents any non-primitive object instance + * (i.e. anything except object, boolean, integer, float, date-time, or string) + * from the MOBY data type ontology. The members of the composite + * object are stored in a Java Map, and can be either primitives, or + * other composites. + * * This class implements the ConcurrentMap interface to allow for the easy * editing of a composite object's members at runtime. */ From gordonp at dev.open-bio.org Fri Jul 6 18:11:02 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 6 Jul 2007 18:11:02 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707062211.l66MB2p5019919@dev.open-bio.org> gordonp Fri Jul 6 18:11:01 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv19884/src/main/org/biomoby/shared/data Modified Files: MobyDataObject.java Log Message: Javadoc: Clarified role of this class in representing MOBY data instances (i.e. limited) moby-live/Java/src/main/org/biomoby/shared/data MobyDataObject.java,1.17,1.18 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/06/19 18:05:35 1.17 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/07/06 22:11:01 1.18 @@ -21,8 +21,12 @@ import org.biomoby.shared.parser.MobyTags; /** - * A class representing a MOBY object that has been instantiated. - * It provides methods to instantiate the object value either simply using an ID (in which case an + * A class representing a base MOBY object (i.e. just a namespace and id) that has been instantiated. + * If you are looking to represent an object with members (e.g. DNASequence), look at MobyDataComposite. + * If you are looking to represent a MOBY primitive object, please see the appropriate + * subclass of this class (e.g. MobyDataInteger). + * + * This class provides methods to instantiate the object value either simply using an ID (in which case an * Object tag is created automatically), or via XML input either from a DOM Element * (preferred) or a string containing the XML. The toXML method will return either service call * or search template formatted XML depending on the mode set. From kawas at dev.open-bio.org Mon Jul 9 15:54:31 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 9 Jul 2007 15:54:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707091954.l69JsV4a031288@dev.open-bio.org> kawas Mon Jul 9 15:54:31 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31253/RDF/Ontologies Modified Files: Objects.pm Log Message: removed bnodes from RDF. structure a little different than before... BETA moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 19:54:31 1.2 @@ -73,6 +73,7 @@ # create an object my $self = bless {}, ref($class) || $class; $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; + $self->{uri_comp} = 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; $self->{query_all} = < $storage ); my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; - + # add root of ontology - { - my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); -# $model->addStmt( -# new RDF::Core::Statement( -# $resource, -# $resource->new( MOBY::RDF::Predicates::RDF->type ), -# new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) -# ) -# ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal("Object") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal( -"a base object class consisting of a namespace and an identifier" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal("openinformatics.com") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), - new RDF::Core::Literal( -"urn:lsid:biomoby.org:objectclass:Object:2001-09-21T16-00-00Z" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal("jason\@openinformatics.com") - ) - ); - } + $self->_addOntologyRoot($model); my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -181,15 +134,177 @@ my $lsid = $$ref[5]; my $authority = $$ref[6]; my $email = $$ref[7]; - + my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + + } + $sth->finish(); + $db->disconnect(); + + my $xml = ''; + my $serializer = new RDF::Core::Model::Serializer( + Model => $model, + Output => \$xml, + BaseURI => 'URI://BASE/', + ); + $serializer->serialize; + return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) + unless $prettyPrint eq 'no'; + return $xml; +} + +=head2 createByName + +Return a string of RDF in XML that represents a specific datatype in the + Objects ontology. This sub routine takes one argument, 'term', + that represents the ontology term that you would like to create RDF + for. For example, the term 'DNASequence' would return RDF describing + DNASequence and all of its parents and container relationships. + + This routine consumes a hash as input with keys: + term: the node to retrieve B + prettyPrint: whether (yes) or not (no) to output 'pretty print' formatted XML. Defaults to 'yes'. + +=cut + +sub createByName { + my ( $self, $hash ) = @_; + die "No term specified!" unless $hash->{term}; + + # set up the term that we care about + my $term = $hash->{term}; + my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; + + my $termExists = 0; + + # set up an RDF model + my $storage = new RDF::Core::Storage::Memory; + my $model = new RDF::Core::Model( Storage => $storage ); + + # add root of ontology + $self->_addOntologyRoot($model); + my $node_factory = new RDF::Core::NodeFactory(); + + do { + my $CONF = MOBY::Config->new; + my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); + my $db = $adap->dbh; + my $sth = $db->prepare( $self->{query} ); + $sth->execute( ($term) ); + +# this line is here, because there are some datatypes in the ontology not rooted at 'Object' and while illegal, this would kill this code. + $term = ''; + + #base case + $term = '' if $term eq 'Object'; + + # returns an array of hash references + while ( my $ref = $sth->fetchrow_arrayref ) { + $termExists++; + my $subject = $$ref[0]; + my $relationship = $$ref[1]; + my $object = $$ref[2]; + my $articlename = $$ref[3] || ''; + my $description = $$ref[4]; + my $lsid = $$ref[5]; + my $authority = $$ref[6]; + my $email = $$ref[7]; + my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); + $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + do { + $term = $object; + } if $relationship =~ m/.*\:isa$/; + + } + $sth->finish(); + $db->disconnect(); + + } while ( $term && $term ne '' ); + my $xml = ''; + my $serializer = new RDF::Core::Model::Serializer( + Model => $model, + Output => \$xml, + BaseURI => 'URI://BASE/', + ); + $serializer->serialize; + + # dont output anything unless term exists! + unless ( $termExists > 0 ) { + $xml = < +END + } + return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) + unless $prettyPrint eq 'no'; + return $xml; +} + +sub _addOntologyRoot { + my ( $self, $model ) = @_; + my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); + + # $model->addStmt( + # new RDF::Core::Statement( + # $resource, + # $resource->new( MOBY::RDF::Predicates::RDF->type ), + # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + # ) + # ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->label ), + new RDF::Core::Literal("Object") + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->comment ), + new RDF::Core::Literal( +"a base object class consisting of a namespace and an identifier" ) - ); + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), + new RDF::Core::Literal("openinformatics.com") + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), + new RDF::Core::Literal( + "urn:lsid:biomoby.org:objectclass:Object:2001-09-21T16-00-00Z" + ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), + new RDF::Core::Literal("jason\@openinformatics.com") + ) + ); + +} + +sub _foo { + +my ($self,$model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email) = @_; + + + # $model->addStmt( + # new RDF::Core::Statement( + # $resource, + # $resource->new( MOBY::RDF::Predicates::RDF->type ), + # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + # ) + # ); $model->addStmt( new RDF::Core::Statement( $resource, @@ -240,159 +355,73 @@ # add hasa container relationships do { - my $bnode = new RDF::Core::NodeFactory()->newResource; - my $container = new RDF::Core::Resource( $self->{uri}, $object ); + my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); + $model->addStmt( + new RDF::Core::Statement( + $container, $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) + ) + ); $model->addStmt( new RDF::Core::Statement( $resource, $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->hasa ), - $bnode + $container ) ); $model->addStmt( new RDF::Core::Statement( - $bnode, - $bnode->new( + $container, + $container->new( MOBY::RDF::Predicates::MOBY_PREDICATES->articleName ), - new RDF::Core::Literal($object) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container + new RDF::Core::Literal($articlename) ) ); + $self->_processISAs($model, $object); + } if $relationship =~ m/.*\:hasa$/; # add has container relationship do { - my $bnode = new RDF::Core::NodeFactory()->newResource; - my $container = new RDF::Core::Resource( $self->{uri}, $object ); + my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); + $model->addStmt( + new RDF::Core::Statement( + $container, $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) + ) + ); + $model->addStmt( new RDF::Core::Statement( $resource, $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->has ), - $bnode + $container ) ); $model->addStmt( new RDF::Core::Statement( - $bnode, - $bnode->new( + $container, + $container->new( MOBY::RDF::Predicates::MOBY_PREDICATES->articleName ), - new RDF::Core::Literal($object) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container + new RDF::Core::Literal($articlename) ) ); + $self->_processISAs($model, $object); + } if $relationship =~ m/.*\:has$/; - } - $sth->finish(); - $db->disconnect(); - - my $xml = ''; - my $serializer = new RDF::Core::Model::Serializer( - Model => $model, - Output => \$xml, - BaseURI => 'URI://BASE/', - ); - $serializer->serialize; - return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) unless $prettyPrint eq 'no'; - return $xml; } -=head2 createByName - -Return a string of RDF in XML that represents a specific datatype in the - Objects ontology. This sub routine takes one argument, 'term', - that represents the ontology term that you would like to create RDF - for. For example, the term 'DNASequence' would return RDF describing - DNASequence and all of its parents and container relationships. - - This routine consumes a hash as input with keys: - term: the node to retrieve B - prettyPrint: whether (yes) or not (no) to output 'pretty print' formatted XML. Defaults to 'yes'. - -=cut +sub _processISAs { + my ( $self, $model, $term ) = @_; -sub createByName { - my ( $self, $hash ) = @_; - die "No term specified!" unless $hash->{term}; - - # set up the term that we care about - my $term = $hash->{term}; - my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; - my $termExists = 0; - - # set up an RDF model - my $storage = new RDF::Core::Storage::Memory; - my $model = new RDF::Core::Model( Storage => $storage ); - - # add root of ontology - { - my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); -# $model->addStmt( -# new RDF::Core::Statement( -# $resource, -# $resource->new( MOBY::RDF::Predicates::RDF->type ), -# new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) -# ) -# ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal("Object") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal( -"a base object class consisting of a namespace and an identifier" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal("openinformatics.com") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), - new RDF::Core::Literal( -"urn:lsid:biomoby.org:objectclass:Object:2001-09-21T16-00-00Z" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal("jason\@openinformatics.com") - ) - ); - } - my $node_factory = new RDF::Core::NodeFactory(); - - # add the datatype Object to the model + do { my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -417,155 +446,19 @@ my $lsid = $$ref[5]; my $authority = $$ref[6]; my $email = $$ref[7]; - my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); -# $model->addStmt( -# new RDF::Core::Statement( -# $resource, -# $resource->new( MOBY::RDF::Predicates::RDF->type ), -# new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) -# ) -# ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal($subject) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal($description) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::DC_PROTEGE->publisher - ), - new RDF::Core::Literal($authority) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::DC_PROTEGE->identifier - ), - new RDF::Core::Literal($lsid) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::DC_PROTEGE->creator - ), - new RDF::Core::Literal($email) - ) - ); - - # add subclassof, if applicable + $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); do { - my $parent = new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::RDFS->subClassOf - ), - $parent - ) - ); $term = $object; } if $relationship =~ m/.*\:isa$/; - # add hasa container relationships - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->hasa - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:hasa$/; - - # add has container relationship - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->has - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:has$/; - } $sth->finish(); $db->disconnect(); } while ( $term && $term ne '' ); - my $xml = ''; - my $serializer = new RDF::Core::Model::Serializer( - Model => $model, - Output => \$xml, - BaseURI => 'URI://BASE/', - ); - $serializer->serialize; - # dont output anything unless term exists! - unless ( $termExists > 0 ) { - $xml = < -END - } - return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) unless $prettyPrint eq 'no'; - return $xml; } + 1; __END__ From kawas at dev.open-bio.org Mon Jul 9 16:53:46 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 9 Jul 2007 16:53:46 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707092053.l69KrkRr031405@dev.open-bio.org> kawas Mon Jul 9 16:53:46 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31370/RDF/Ontologies Modified Files: Objects.pm Log Message: renamed a few routines and applied url + base64 to articlenames in the URI portion of HAS/HASA members. moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 19:54:31 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 20:53:46 1.3 @@ -27,6 +27,8 @@ use MOBY::RDF::Utils; +use MIME::Base64; +use CGI; use strict; #----------------------------------------------------------------- @@ -72,8 +74,9 @@ # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; - $self->{uri_comp} = 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; + $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; + $self->{uri_comp} = + 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; $self->{query_all} = <{uri}, $subject ); - $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + $self->_processDatatype( + $model, $resource, $subject, $relationship, + $object, $articlename, $description, $lsid, + $authority, $email + ); } $sth->finish(); @@ -185,7 +192,7 @@ # add root of ontology $self->_addOntologyRoot($model); my $node_factory = new RDF::Core::NodeFactory(); - + do { my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -211,7 +218,11 @@ my $authority = $$ref[6]; my $email = $$ref[7]; my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); - $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + $self->_processDatatype( + $model, $resource, $subject, $relationship, + $object, $articlename, $description, $lsid, + $authority, $email + ); do { $term = $object; } if $relationship =~ m/.*\:isa$/; @@ -240,6 +251,9 @@ return $xml; } + +#####-----------------------Private Routines--------------------------##### + sub _addOntologyRoot { my ( $self, $model ) = @_; my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); @@ -293,135 +307,141 @@ } -sub _foo { +sub _processDatatype { + + my ( + $self, $model, $resource, $subject, + $relationship, $object, $articlename, $description, + $lsid, $authority, $email + ) + = @_; -my ($self,$model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email) = @_; - + # $model->addStmt( + # new RDF::Core::Statement( + # $resource, + # $resource->new( MOBY::RDF::Predicates::RDF->type ), + # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + # ) + # ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->label ), + new RDF::Core::Literal($subject) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->comment ), + new RDF::Core::Literal($description) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), + new RDF::Core::Literal($authority) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), + new RDF::Core::Literal($lsid) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), + new RDF::Core::Literal($email) + ) + ); - # $model->addStmt( - # new RDF::Core::Statement( - # $resource, - # $resource->new( MOBY::RDF::Predicates::RDF->type ), - # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - # ) - # ); + # add subclassof, if applicable + do { + my $parent = new RDF::Core::Resource( $self->{uri}, $object ); $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal($subject) + $resource->new( MOBY::RDF::Predicates::RDFS->subClassOf ), + $parent ) ); + } if $relationship =~ m/.*\:isa$/; + + # add hasa container relationships + do { + my $container = + new RDF::Core::Resource( $self->{uri_comp}, + $subject . "_" . CGI::escape(encode_base64("$articlename")) ); $model->addStmt( new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal($description) + $container, + $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) ) ); $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal($authority) + $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->hasa ), + $container ) ); $model->addStmt( new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), - new RDF::Core::Literal($lsid) + $container, + $container->new( + MOBY::RDF::Predicates::MOBY_PREDICATES->articleName + ), + new RDF::Core::Literal($articlename) ) ); + $self->_processISAs( $model, $object ); + + } if $relationship =~ m/.*\:hasa$/; + + # add has container relationship + do { + my $container = + new RDF::Core::Resource( $self->{uri_comp}, + $subject . "_" . CGI::escape (encode_base64("$articlename"))); $model->addStmt( new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal($email) + $container, + $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) ) ); - # add subclassof, if applicable - do { - my $parent = new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->subClassOf ), - $parent - ) - ); - } if $relationship =~ m/.*\:isa$/; + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->has ), + $container + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $container, + $container->new( + MOBY::RDF::Predicates::MOBY_PREDICATES->articleName + ), + new RDF::Core::Literal($articlename) + ) + ); + $self->_processISAs( $model, $object ); - # add hasa container relationships - do { - my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); - $model->addStmt( - new RDF::Core::Statement( - $container, $container->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( $self->{uri}, $object ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->hasa - ), - $container - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $container, - $container->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $self->_processISAs($model, $object); - - } if $relationship =~ m/.*\:hasa$/; - - # add has container relationship - do { - my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); - $model->addStmt( - new RDF::Core::Statement( - $container, $container->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( $self->{uri}, $object ) - ) - ); - - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->has - ), - $container - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $container, - $container->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $self->_processISAs($model, $object); - - } if $relationship =~ m/.*\:has$/; + } if $relationship =~ m/.*\:has$/; } sub _processISAs { my ( $self, $model, $term ) = @_; my $termExists = 0; - + do { my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -447,7 +467,11 @@ my $authority = $$ref[6]; my $email = $$ref[7]; my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); - $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + $self->_processDatatype( + $model, $resource, $subject, $relationship, + $object, $articlename, $description, $lsid, + $authority, $email + ); do { $term = $object; } if $relationship =~ m/.*\:isa$/; @@ -459,6 +483,5 @@ } while ( $term && $term ne '' ); } - 1; __END__ From gordonp at dev.open-bio.org Wed Jul 11 11:06:57 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 11 Jul 2007 11:06:57 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707111506.l6BF6vKh005460@dev.open-bio.org> gordonp Wed Jul 11 11:06:57 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv5425/src/main/ca/ucalgary/seahawk/gui Modified Files: SeahawkOptionsGUI.java Log Message: Improvements to UI layout implemented by dmitry.repchevski at bsc.es moby-live/Java/src/main/ca/ucalgary/seahawk/gui SeahawkOptionsGUI.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java 2007/06/16 00:32:56 1.4 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java 2007/07/11 15:06:57 1.5 @@ -48,135 +48,151 @@ * @param owner the frame that launches this dialog */ public SeahawkOptionsGUI(Frame owner){ - super(owner, DIALOG_TITLE, DIALOG_MODAL); + super(owner, DIALOG_TITLE, DIALOG_MODAL); - // Custom handling of window close operation - setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - addWindowListener(this); - - // The dreaded GridBagLayout... - GridBagLayout gridbag = new GridBagLayout(); - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - setLayout(gridbag); + // Custom handling of window close operation + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addWindowListener(this); + + // The dreaded GridBagLayout... + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.BOTH; + setLayout(gridbag); - registriesList = new RegistriesList(); - Registry[] registries = registriesList.getAll(); - registryNames = new String[registries.length+1]; - int i = 0; - for(; i < registries.length; i++){ - registryNames[i] = registries[i].getSynonym(); - } - registryNames[i] = CUSTOM_REGISTRY_SYNONYM; - - JLabel label = new JLabel("Registry server:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryComboBox = new JComboBox(registryNames); - registryComboBox.addActionListener(this); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 1.0; - gridbag.setConstraints(registryComboBox, c); - add(registryComboBox); - - label = new JLabel("Description:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryDescTextArea = new JTextPane(); - registryDescTextArea.setEditable(false); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 0.0; // 0 so long lines wrap in text area - c.weighty = 1.0; // absorb all extra vertical space in the desc - gridbag.setConstraints(registryDescTextArea, c); - add(registryDescTextArea); - c.weighty = 0.0; //reset - - label = new JLabel("Location:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryEndpoint = new JTextField(50); - registryEndpoint.setEditable(false); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 1.0; - gridbag.setConstraints(registryEndpoint, c); - add(registryEndpoint); - - label = new JLabel("Namespace:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryNamespace = new JTextField(50); - registryNamespace.setEditable(false); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 1.0; - gridbag.setConstraints(registryNamespace, c); - add(registryNamespace); - - JSeparator line = new JSeparator(); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(line, c); - add(line); - - sendReferrerCheckBox = new JCheckBox("Send referrer data to services"); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(sendReferrerCheckBox, c); - add(sendReferrerCheckBox); - - line = new JSeparator(); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(line, c); - add(line); - - JPanel expiryPanel = new JPanel(new GridLayout(1,0)); - label = new JLabel("Cache expiry (in hours)"); - expiryPanel.add(label); - cacheExpiryTextField = new JTextField(3); - expiryPanel.add(cacheExpiryTextField); - c.gridwidth = 1; - gridbag.setConstraints(expiryPanel, c); - add(expiryPanel); - deleteCacheButton = new JButton("Delete cached items"); - deleteCacheButton.addActionListener(this); - c.gridwidth = 1; - gridbag.setConstraints(deleteCacheButton, c); - add(deleteCacheButton); - - selectCacheDirButton = new JButton("Change cache directory"); - selectCacheDirButton.addActionListener(this); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(selectCacheDirButton, c); - add(selectCacheDirButton); - cacheDirFileChooser = new JFileChooser(); - cacheDirFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - line = new JSeparator(); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(line, c); - add(line); - - resetButton = new JButton("Restore program defaults"); - resetButton.addActionListener(this); - c.gridwidth = 1; - gridbag.setConstraints(resetButton, c); - add(resetButton); - cancelButton = new JButton("Cancel"); - cancelButton.addActionListener(this); - c.gridwidth = 1; - gridbag.setConstraints(cancelButton, c); - add(cancelButton); - okButton = new JButton("Apply changes"); - okButton.addActionListener(this); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(okButton, c); - add(okButton); + registriesList = new RegistriesList(); + Registry[] registries = registriesList.getAll(); + registryNames = new String[registries.length+1]; + int i = 0; + for(; i < registries.length; i++){ + registryNames[i] = registries[i].getSynonym(); + } + registryNames[i] = CUSTOM_REGISTRY_SYNONYM; + + c.insets = new Insets(3,2,3,2); + //........................................ + + c.gridwidth = 2; + c.fill = GridBagConstraints.HORIZONTAL; + JLabel label = new JLabel("Registry server:", JLabel.RIGHT); + add(label, c); + + registryComboBox = new JComboBox(registryNames); + registryComboBox.addActionListener(this); + add(registryComboBox, c); + + c.gridheight = 4; + c.fill = GridBagConstraints.NONE; + JPanel bPanel = new JPanel(new GridLayout(3, 0, 3, 3)); + resetButton = new JButton("Restore program defaults"); + resetButton.addActionListener(this); + + cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(this); + + okButton = new JButton("Apply changes"); + okButton.addActionListener(this); + + bPanel.add(resetButton); + bPanel.add(cancelButton); + bPanel.add(okButton); + + add(bPanel, c); + + //........................................ + c.gridx = 0; + c.gridy = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.BOTH; + label = new JLabel("Description:", JLabel.RIGHT); + label.setVerticalAlignment(JLabel.TOP); + add(label, c); + + c.gridx = 2; + c.weightx = 1.0; + c.weighty = 1.0; + registryDescTextArea = new JTextPane(); + registryDescTextArea.setEditable(false); + add(registryDescTextArea, c); + + //........................................ + c.gridx = 0; + c.gridy = 2; + c.weightx = 0.0; + c.weighty = 0.0; + c.fill = GridBagConstraints.HORIZONTAL; + label = new JLabel("Location:", JLabel.RIGHT); + add(label, c); + + c.gridx = 2; + registryEndpoint = new JTextField(50); + registryEndpoint.setEditable(false); + add(registryEndpoint, c); + + //........................................ + + c.gridx = 0; + c.gridy = 3; + label = new JLabel("Namespace:", JLabel.RIGHT); + add(label, c); + + c.gridx = 2; + registryNamespace = new JTextField(50); + registryNamespace.setEditable(false); + add(registryNamespace, c); + + //........................................ + c.gridx = 0; + c.gridy = 4; + c.gridwidth = 6; + JSeparator line = new JSeparator(); + add(line, c); + + //........................................ + c.gridx = 0; + c.gridy = 5; + c.gridwidth = 4; + c.gridheight = 1; + sendReferrerCheckBox = new JCheckBox("Send referrer data to services"); + add(sendReferrerCheckBox, c); + + //........................................ + c.gridy = 6; + c.gridwidth = 6; + line = new JSeparator(); + add(line, c); + + //........................................ + c.gridy = 7; + c.gridwidth = 2; + label = new JLabel("Cache expiry (in hours)", JLabel.RIGHT); + add(label, c); + + c.gridx = 2; + c.gridwidth = 1; + cacheExpiryTextField = new JTextField(3); + cacheExpiryTextField.setMinimumSize(cacheExpiryTextField.getPreferredSize()); // prevents text collapsing + add(cacheExpiryTextField, c); + + c.gridx = 3; + c.gridwidth = 3; + c.fill = GridBagConstraints.NONE; + JPanel cbPanel = new JPanel(new GridLayout(1,0,4,2)); + + deleteCacheButton = new JButton("Delete cached items"); + deleteCacheButton.addActionListener(this); + + selectCacheDirButton = new JButton("Change cache directory"); + selectCacheDirButton.addActionListener(this); + + cbPanel.add(deleteCacheButton); + cbPanel.add(selectCacheDirButton); + + cacheDirFileChooser = new JFileChooser(); + cacheDirFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + add(cbPanel, c); + setCurrentValues(); pack(); } @@ -372,4 +388,17 @@ public void windowDeiconified(WindowEvent e){} public void windowIconified(WindowEvent e){} public void windowOpened(WindowEvent e){} + + public static void main(String[] args) + { + JFrame frame = new JFrame("test"); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + SeahawkOptionsGUI dialog = new SeahawkOptionsGUI(frame); + + frame.pack(); + frame.setVisible(true); + + dialog.setVisible(true); + } } From kawas at dev.open-bio.org Mon Jul 16 17:28:10 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 16 Jul 2007 17:28:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707162128.l6GLSA3V021999@dev.open-bio.org> kawas Mon Jul 16 17:28:09 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv21963/RDF/Ontologies Modified Files: Namespaces.pm Log Message: when querying for the root namespace (Namespace), empty rdf was returned. now not so much! moby-live/Perl/MOBY/RDF/Ontologies Namespaces.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/16 21:28:09 1.2 @@ -263,7 +263,9 @@ my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; my $termExists = 0; - + #special case where term == Namespace + $termExists = $termExists + 1 if $term eq 'Namespace'; + # set up an RDF model my $storage = new RDF::Core::Storage::Memory; my $model = new RDF::Core::Model( Storage => $storage ); @@ -332,7 +334,6 @@ #base case $term = '' if $term eq 'Namespace'; - # returns an array of hash references while ( my $ref = $sth->fetchrow_arrayref ) { $termExists++; From kawas at dev.open-bio.org Tue Jul 17 13:25:40 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 17 Jul 2007 13:25:40 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707171725.l6HHPeIX025946@dev.open-bio.org> kawas Tue Jul 17 13:25:39 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv25915/lsid/authority Added Files: MobyMetadataResolver.pm Log Message: initial checkin of the getMetadata handlers for the LSID namespaces of namespacetype, servicetype, serviceinstance and objectclass. This code doesnt handle relationshiptype yet. The LSID authority perl script will be in moby-live/Perl/scripts/ and called authority.pl. This code requires the module LS::ID moby-live/Perl/MOBY/lsid/authority MobyMetadataResolver.pm,NONE,1.1 From kawas at dev.open-bio.org Tue Jul 17 14:11:43 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 17 Jul 2007 14:11:43 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707171811.l6HIBhg5026243@dev.open-bio.org> kawas Tue Jul 17 14:11:42 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv26208/Java/src/main/org/biomoby/shared/extended Modified Files: DataTypeParser.java Log Message: added one line that enables compatibility with RDF generated by PERL. moby-live/Java/src/main/org/biomoby/shared/extended DataTypeParser.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2006/04/27 14:47:37 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2007/07/17 18:11:42 1.7 @@ -169,6 +169,7 @@ continue; String uri = resource.getURI(); + if (uri.indexOf("/MOBY_SUB_COMPONENT/") > 0) continue; String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); From kawas at dev.open-bio.org Tue Jul 17 16:34:37 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 17 Jul 2007 16:34:37 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707172034.l6HKYbAr026528@dev.open-bio.org> kawas Tue Jul 17 16:34:36 EDT 2007 Update of /home/repository/moby/moby-live/Perl/scripts In directory dev.open-bio.org:/tmp/cvs-serv26497 Added Files: authority.pl Log Message: lsid authority server code moby-live/Perl/scripts authority.pl,NONE,1.1 From kawas at dev.open-bio.org Wed Jul 18 14:55:07 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 18 Jul 2007 14:55:07 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181855.l6IIt7on029232@dev.open-bio.org> kawas Wed Jul 18 14:55:07 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/support/rdfagent In directory dev.open-bio.org:/tmp/cvs-serv29192/Java/src/support/rdfagent Modified Files: run-RDFagent.bat run-RDFagent Log Message: added more heap space to the scripts that call the agent moby-live/Java/src/support/rdfagent run-RDFagent.bat,1.8,1.9 run-RDFagent,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent.bat,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent.bat 2006/10/17 14:23:15 1.8 +++ /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent.bat 2007/07/18 18:55:07 1.9 @@ -8,8 +8,10 @@ set JAVA_HOME=C:/Java/jdk1.5.0_05 set AGENT_HOME=C:/moby-live/Java/docs/dist/rdfagent +rem this line here to add more heap space +set JAVA_OPTS=-Xmx256m -%JAVA_HOME%\bin\java -DRDFagent.home="%AGENT_HOME%" -jar "%AGENT_HOME%RDFagent.jar" %1 %2 +%JAVA_HOME%\bin\java %JAVA_OPTS% -DRDFagent.home="%AGENT_HOME%" -jar "%AGENT_HOME%RDFagent.jar" %1 %2 if %ERRORLEVEL%==0 GOTO DONE goto ERROR =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent 2006/03/02 16:41:02 1.6 +++ /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent 2007/07/18 18:55:07 1.7 @@ -12,8 +12,8 @@ # please set the following paths JAVA_HOME=/usr/local/jdk1.5.0_03 RDF_AGENT_HOME=/path/to/home/dir/of/rdfagent - -$JAVA_HOME/bin/java -DRDFagent.home=$RDF_AGENT_HOME -jar $RDF_AGENT_HOME/RDFagent.jar $* +JAVA_OPTS=-Xmx256m +$JAVA_HOME/bin/java $JAVA_OPTS -DRDFagent.home=$RDF_AGENT_HOME -jar $RDF_AGENT_HOME/RDFagent.jar $* # did the agent die unexpectedly? check_errs $? From kawas at dev.open-bio.org Thu Jul 19 14:26:59 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 19 Jul 2007 14:26:59 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707191826.l6JIQxEC031568@dev.open-bio.org> kawas Thu Jul 19 14:26:59 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31521/RDF/Ontologies Modified Files: Objects.pm Namespaces.pm Services.pm ServiceTypes.pm Log Message: removed rdf:type->owl:Class statements. Read URIs for each ontology from mobycentral.confgi moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.3,1.4 Namespaces.pm,1.2,1.3 Services.pm,1.1,1.2 ServiceTypes.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 20:53:46 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/19 18:26:59 1.4 @@ -21,7 +21,6 @@ use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -74,9 +73,16 @@ # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; - $self->{uri_comp} = - 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobyobject}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyobject" )->dbh; + + $self->{uri_comp} = $self->{uri}; + $self->{uri_comp} =~ s/\/MOBY\-S\//\/MOBY_SUB_COMPONENT\//; + $self->{query_all} = <_addOntologyRoot($model); - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -194,9 +198,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -443,9 +445,7 @@ my $termExists = 0; do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/16 21:28:09 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/19 18:26:59 1.3 @@ -21,7 +21,6 @@ use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -72,7 +71,13 @@ # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobynamespace" )->dbh; + $self->{query_all} = <addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Namespace") ) @@ -160,9 +158,7 @@ ); } - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobynamespace" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -178,13 +174,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) @@ -276,13 +265,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Namespace") ) @@ -324,9 +306,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobynamespace" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -347,13 +327,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/19 18:26:59 1.2 @@ -22,7 +22,6 @@ use MOBY::RDF::Predicates::FETA; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -85,7 +84,11 @@ #TODO - Extract the URIs for Namespaces/ServiceTypes/Objects/ServiceInstances from the moby config file # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobycentral}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; # done return $self; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/07/19 18:26:59 1.2 @@ -21,7 +21,6 @@ use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -73,7 +72,13 @@ # create an object my $self = bless {}, ref ($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Services#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobyservice}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Services#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyservice" )->dbh; + $self->{query_all} = <addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Service") ) @@ -165,9 +163,7 @@ ); } - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyservice" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -186,13 +182,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) @@ -282,13 +271,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Service") ) @@ -331,9 +313,7 @@ # add the datatype Object to the model do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyservice" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -358,13 +338,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) @@ -418,69 +391,6 @@ ); $term = $object; } if $relationship =~ m/.*\:isa$/; - - # add hasa container relationships - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->hasa - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:hasa$/; - - # add has container relationship - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->has - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:has$/; - } $sth->finish(); $db->disconnect(); From kawas at dev.open-bio.org Thu Jul 19 15:38:11 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 19 Jul 2007 15:38:11 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707191938.l6JJcB3Q031661@dev.open-bio.org> kawas Thu Jul 19 15:38:11 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31626/RDF/Ontologies Modified Files: Services.pm Log Message: removed a duplicated line of code that was causing warnings. moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/19 18:26:59 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/19 19:38:11 1.3 @@ -143,8 +143,7 @@ my $storage = new RDF::Core::Storage::Memory; my $model = new RDF::Core::Model( Storage => $storage ); my $node_factory = new RDF::Core::NodeFactory(); - my $node_factory = new RDF::Core::NodeFactory(); - + foreach my $SI (@$services) { my $resource = new RDF::Core::Resource( $self->{uri}, From kawas at dev.open-bio.org Thu Jul 19 15:39:17 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 19 Jul 2007 15:39:17 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707191939.l6JJdHgF031704@dev.open-bio.org> kawas Thu Jul 19 15:39:17 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates In directory dev.open-bio.org:/tmp/cvs-serv31669/RDF/Predicates Modified Files: FETA.pm Log Message: removed a duplicated line of code that was causing warnings. moby-live/Perl/MOBY/RDF/Predicates FETA.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/FETA.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/FETA.pm 2007/07/05 17:31:48 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/FETA.pm 2007/07/19 19:39:17 1.2 @@ -1,6 +1,7 @@ package MOBY::RDF::Predicates::FETA; use strict; +use warnings; BEGIN { @@ -56,7 +57,6 @@ use constant providedBy => FETA_URI . 'providedBy'; use constant mygInstance => FETA_URI . 'mygInstance'; use constant performsTask => FETA_URI . 'performsTask'; - use constant operationTask => FETA_URI . 'operationTask'; use constant usesMethod => FETA_URI . 'usesMethod'; use constant operationMethod => FETA_URI . 'operationMethod'; use constant isFunctionOf => FETA_URI . 'isFunctionOf'; From gordonp at dev.open-bio.org Mon Jul 23 17:32:28 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 17:32:28 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232132.l6NLWSs9017776@dev.open-bio.org> gordonp Mon Jul 23 17:32:27 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test In directory dev.open-bio.org:/tmp/cvs-serv17740/src/main/org/biomoby/service/test Modified Files: MobyServletTestCase.java Log Message: Changed servlet port moby-live/Java/src/main/org/biomoby/service/test MobyServletTestCase.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2007/04/12 00:54:16 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2007/07/23 21:32:27 1.5 @@ -22,7 +22,7 @@ public class MobyServletTestCase extends TestCase{ private final static String TEST_MOBY_XML = "org/biomoby/service/test/mobyAASeq.xml"; private final static String SERVLET_TEST_WEBXML = "org/biomoby/service/test/web.xml"; - private final static String SERVLET_TEST_URL = "http://moby.ucalgary.ca:8089/MobyServlet"; + private final static String SERVLET_TEST_URL = "http://moby.ucalgary.ca:8080/MobyServlet"; private final static String TEST_MAIN_CLASS_NAME = "org.biomoby.service.test.ConvertAAtoFASTA_AA"; /** From gordonp at dev.open-bio.org Mon Jul 23 17:32:58 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 17:32:58 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232132.l6NLWwWa017820@dev.open-bio.org> gordonp Mon Jul 23 17:32:58 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv17784/src/main/org/biomoby/shared/data Modified Files: MobyDataString.java Log Message: Allow null string in c-tor moby-live/Java/src/main/org/biomoby/shared/data MobyDataString.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/06/07 23:58:15 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/07/23 21:32:58 1.7 @@ -43,7 +43,7 @@ public MobyDataString(String articleName, CharSequence stringValue, Registry registry){ super(articleName); setDataType(MobyDataType.getDataType(MobyTags.MOBYSTRING, registry)); - value = new StringBuffer(stringValue.toString()); + value = stringValue == null ? null : new StringBuffer(stringValue.toString()); } public MobyDataString(CharSequence stringValue){ From gordonp at dev.open-bio.org Mon Jul 23 17:35:26 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 17:35:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232135.l6NLZQfD017888@dev.open-bio.org> gordonp Mon Jul 23 17:35:25 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services In directory dev.open-bio.org:/tmp/cvs-serv17852/src/main/ca/ucalgary/seahawk/services Modified Files: MobyComplexBuilder.java Log Message: Fixed support for base64 rules moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyComplexBuilder.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java 2007/06/28 16:45:44 1.10 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java 2007/07/23 21:35:25 1.11 @@ -3,8 +3,9 @@ import ca.ucalgary.seahawk.util.SeahawkOptions; import org.biomoby.shared.*; -import org.biomoby.shared.data.MobyDataObject; +import org.biomoby.shared.data.MobyDataBytes; import org.biomoby.shared.data.MobyDataComposite; +import org.biomoby.shared.data.MobyDataObject; import org.w3c.dom.Document; @@ -171,6 +172,10 @@ if(mobyDataType.getName().equals("Object")){ mobyObj = new MobyDataObject("", SeahawkOptions.getRegistry()); } + else if(mobyDataType.inheritsFrom(MobyDataBytes.BASE64_DATATYPE)){ + mobyObj = new MobyDataBytes("", (String) null); + mobyObj.setDataType(mobyDataType); + } // else ifs for other primitives in the future maybe? else{ mobyObj = new MobyDataComposite(mobyDataType); @@ -280,7 +285,8 @@ for(String result: results){ - if(PrimitiveTypes.isPrimitive(dataTypeName)){ + if(PrimitiveTypes.isPrimitive(dataTypeName) || + MobyDataType.getDataType(dataTypeName, SeahawkOptions.getRegistry()).inheritsFrom(MobyDataBytes.BASE64_DATATYPE)){ ((MobyDataComposite) mobyObj).put(memberName, MobyDataObject.createInstanceFromString(dataTypeName, result)); } From gordonp at dev.open-bio.org Mon Jul 23 18:01:23 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 18:01:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232201.l6NM1NVj017957@dev.open-bio.org> gordonp Mon Jul 23 18:01:22 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources In directory dev.open-bio.org:/tmp/cvs-serv17921/src/main/ca/ucalgary/services/resources Modified Files: acdRules.xml Log Message: Update to include nested parsing rule example moby-live/Java/src/main/ca/ucalgary/services/resources acdRules.xml,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources/acdRules.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources/acdRules.xml 2007/06/08 14:04:27 1.2 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources/acdRules.xml 2007/07/23 22:01:22 1.3 @@ -78,45 +78,45 @@ string-length('$2') - + (?:\A|\n)\s*(\S+(\x20{2,}|\t+|))+(?=\n|\z) - - $1 - --> + + $1 + + - + (\p{rowWithWhitespaceSeparatedColumns})+ - - $1 - --> + + $1 + - - (CHARGE \s of \s .*?)\n # Description of input (used as caption) + (CHARGE \s of \s .*?)\n # Description of input used as caption \n # Blank line (Position \s+ Charge\n) # Column headers - ((?: \d+ \s+ -?\d+\.\d+ \n)+ ) # One or more lines of (integer) (spaces) (+/-decimal number) - # Ignore any trailing garbage (no \z given to anchor the end of the input being tested) + ((?: \d+ \s+ -?\d+\.\d+ \n)+ ) # One or more lines of integer spaces +/-decimal-number + # Ignore any trailing data, no \z given to anchor end of input being tested - + $1 - + $2 - + (any number of non-whitespace columns separated by spaces). --> $3 - --> + @@ -133,4 +133,4 @@ $0 - \ No newline at end of file + From gordonp at dev.open-bio.org Mon Jul 23 18:12:30 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 18:12:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232212.l6NMCUqR018024@dev.open-bio.org> gordonp Mon Jul 23 18:12:30 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test In directory dev.open-bio.org:/tmp/cvs-serv17988/src/main/ca/ucalgary/seahawk/services/test Modified Files: MobyClientTestCase.java Log Message: Made less verbose moby-live/Java/src/main/ca/ucalgary/seahawk/services/test MobyClientTestCase.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test/MobyClientTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test/MobyClientTestCase.java 2007/06/28 16:47:23 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test/MobyClientTestCase.java 2007/07/23 22:12:30 1.2 @@ -212,7 +212,7 @@ results[0].getDataType().inheritsFrom(targetType)); results[0].setXmlMode(MobyDataInstance.SERVICE_XML_MODE); try{ - MobyDataUtils.toXMLDocument(System.err, new MobyContentInstance(results[0], "param1")); + MobyDataUtils.toXMLDocument(new StringWriter(), new MobyContentInstance(results[0], "param1")); } catch(Exception e){ e.printStackTrace(); fail("Could not serialize the "+TEST_INHERITMEMBER_CLASSNAME+ From kawas at dev.open-bio.org Tue Jul 24 13:26:00 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 24 Jul 2007 13:26:00 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707241726.l6OHQ05W019769@dev.open-bio.org> kawas Tue Jul 24 13:25:59 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19734/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: added 5 subroutines ... create_datatype_cache update_datatype_cache create_service_cache update_service_cache create_cache_dirs These subs help remove the dependency on the java cache. moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2006/10/13 21:51:16 1.1 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:25:59 1.2 @@ -17,6 +17,7 @@ use MOSES::MOBY::Def::Data; use MOSES::MOBY::Def::Namespace; use MOSES::MOBY::Def::Relationship; +use SOAP::Lite; use XML::LibXML; use File::Spec; use strict; @@ -53,6 +54,18 @@ print $cache->cachedir; print $cache->registry(); + # create a cache for datatypes and fill it up + $cache->create_datatype_cache; + + #update the datatype cache + $cache->update_datatype_cache; + + # create a cache for services and fill it up + $cache->create_service_cache; + + #update the services cache + $cache->update_service_cache; + # get a data type called DNASequence my $dna = $cache->get_datatype ('DNASequence'); @@ -182,6 +195,21 @@ } #----------------------------------------------------------------- +# _namespace +# Return a namespace of the $self->registry, or of a given +# registry. +#----------------------------------------------------------------- +sub _namespace { + my ($self, $registry) = @_; + $registry ||= $self->registry; + return $registry if $registry =~ m"^http://"; + my $reg = MOSES::MOBY::Cache::Registries->get ($registry); + return $reg->{namespace} if $reg; + return MOSES::MOBY::Cache::Registries->get ('default')->{namespace}; +} + + +#----------------------------------------------------------------- # init #----------------------------------------------------------------- sub init { @@ -253,6 +281,351 @@ } #----------------------------------------------------------------- +# create_datatype_cache +#----------------------------------------------------------------- + +=head2 create_datatype_cache + +Create the datatype cache. This will over write any pre-existing +cache that it finds. + +Throw an exception if any of the following occur: + * There is a SOAP error calling the registry + * There were write errors on the cache directory or its contents +=cut + +sub create_datatype_cache { + my ($self) = @_; + + # 2 steps: + # -> create a LIST file + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = + $soap->retrieveObjectNames( )->result; + # create cache dirs as needed + $self->create_cache_dirs; + + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + LIST_FILE); + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + + # 2-> foreach datatype store 'retrieveObjectDefinition' + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_string($xml); + + my $nodes = $doc->documentElement()->getChildrenByTagName('Object'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('name'); + my $input =< + $name + +END + $xml = + $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + $name); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + +} + +#----------------------------------------------------------------- +# update_datatype_cache +#----------------------------------------------------------------- + +=head2 update_datatype_cache + +Update the datatype cache. This will update any items that are 'old', +by relying on the LSID for the datatype. + +Throw an exception if any of the following occur: + * A cache to update doesn't exist + * There is a SOAP error calling the registry + * There were read/write errors on the cache directory or its contents + +=cut + +sub update_datatype_cache { + my ($self) = @_; + + my %old_datatypes = (); + my %new_datatypes = (); + my @changed_datatypes = (); + + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE))) { + $self->throw("Datatype cache doesn't exist, so I can't update it. Please create a datatype cache first!"); + } + + # steps: + # read in the LIST file and extract lsids for all datatypes + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + LIST_FILE); + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_file($file); + my $nodes = $doc->documentElement()->getChildrenByTagName('Object'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('name'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $old_datatypes{$name} = $lsid; + } + # get the new LIST file and extract lsids for all datatypes + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = $soap->retrieveObjectNames( )->result; + $parser = XML::LibXML->new(); + $doc = $parser->parse_string($xml); + $nodes = $doc->documentElement()->getChildrenByTagName('Object'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('name'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $new_datatypes{$name} = $lsid; + } + # go through the keys of the new one and if the keys doesnt exist or has been modified, add to 'download' queue + foreach my $dt (keys %new_datatypes) { + next unless !$old_datatypes{$dt} or $old_datatypes{$dt} ne $new_datatypes{$dt}; + push @changed_datatypes, $dt; + } + + # if their where changes, save new LIST file over the old one and get changes + if (scalar @changed_datatypes) { + # save new LIST file + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + # clear used values + $xml = undef; + $file = undef; + $parser = undef; + $doc = undef; + $nodes = undef; + foreach my $name (@changed_datatypes) { + print "Found modified datatype, '$name', updating ...\n"; + my $input =< + $name + +END + $xml = + $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + $name); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + } +} + +#----------------------------------------------------------------- +# create_datatype_cache +#----------------------------------------------------------------- + +=head2 create_datatype_cache + +Create the datatype cache. This will over write any pre-existing +cache that it finds. + +Throw an exception if something bad happens ... TODO explain this better + +=cut + +sub create_service_cache { + my ($self) = @_; + + # 2 steps: + # -> create a LIST file + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = + $soap->retrieveServiceNames( )->result; + # create cache dirs as needed + $self->create_cache_dirs; + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + LIST_FILE); + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + + # 2-> foreach datatype store 'findService' on the authority + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_string($xml); + my %authorities_completed = (); + my $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('authURI'); + next if $authorities_completed{$name}; + $authorities_completed{$name} = 1; + my $input =< + $name + +END + $xml = + $soap->findService ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + $name); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + +} + +#----------------------------------------------------------------- +# update_service_cache +#----------------------------------------------------------------- + +=head2 update_service_cache + +Update the services cache. This will update any items that are 'old', +by relying on the LSID for the datatype. + +Throw an exception if any of the following occur: + * A cache to update doesn't exist + * There is a SOAP error calling the registry + * There were read/write errors on the cache directory or its contents + +=cut + +sub update_service_cache { + my ($self) = @_; + + my %old_services = (); + my %new_services = (); + my %changed_services = (); + + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE))) { + $self->throw("Services cache doesn't exist, so I can't update it. Please create a services cache first!"); + } + + # steps: + # read in the LIST file and extract lsids for all datatypes + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + LIST_FILE); + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_file($file); + my $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('authURI'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $old_services{$name}{$lsid} = 1; + } + # get the new LIST file and extract lsids for all datatypes + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = $soap->retrieveServiceNames( )->result; + $parser = XML::LibXML->new(); + $doc = $parser->parse_string($xml); + $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('authURI'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $new_services{$name}{$lsid} = 1; + } + # go through the keys of the new one and if the keys doesnt exist or has been modified, add to 'download' queue + foreach my $auth (keys %new_services) { + next if $changed_services{$auth}; + foreach my $lsid (keys %{$new_services{$auth}}) { + next unless !$old_services{$auth}{$lsid}; + $changed_services{$auth} = 1; + } + + } + + # if their where changes, save new LIST file over the old one and get changes + if (keys %changed_services) { + # save new LIST file + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + # clear used values + $xml = undef; + $file = undef; + $parser = undef; + $doc = undef; + $nodes = undef; + foreach my $authURI (keys %changed_services) { + my $input =< + $authURI + +END + $xml = + $soap->findService ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + $authURI); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + } +} + +#----------------------------------------------------------------- # _createDataTypeFromXML # given xmlString, build a MOSES::MOBY::Def::DataType #----------------------------------------------------------------- @@ -807,5 +1180,38 @@ } +#----------------------------------------------------------------- +# cache_exists +#----------------------------------------------------------------- + +=head2 create_cache_dirs + +Creates the cache directories needed for generating datatypes and services. + +Throws an exception if there are problems creating the directories. + +=cut + +sub create_cache_dirs { + my ($self)= @_; + my @dirs = ( + File::Spec->catfile ($self->cachedir,$self->_clean ($self->_endpoint),DATATYPES_CACHE), + File::Spec->catdir ($self->cachedir,$self->_clean ($self->_endpoint),SERVICES_CACHE), + File::Spec->catdir ($self->cachedir,$self->_clean ($self->_endpoint),NAMESPACES_CACHE), + File::Spec->catdir ($self->cachedir,$self->_clean ($self->_endpoint),SERVICETYPES_CACHE), + ); + + foreach my $file (@dirs) { + my ($v, $d, $f) = File::Spec->splitpath( $file ); + my $dir = File::Spec->catdir($v); + foreach my $part ( File::Spec->splitdir( ($d.$f ) ) ) { + $dir = File::Spec->catdir($dir, $part); + next if -d $dir or -e $dir; + mkdir( $dir ) || $self->throw("Error creating caching directory '".$dir."':\n$!"); + } + } +} + + 1; __END__ From kawas at dev.open-bio.org Tue Jul 24 13:29:38 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 24 Jul 2007 13:29:38 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707241729.l6OHTc94019812@dev.open-bio.org> kawas Tue Jul 24 13:29:38 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19777/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: fixed the documentation, i,e, places where 'something bad happens' have been replaced with the bad thing that would happen ;-) moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:25:59 1.2 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:29:38 1.3 @@ -452,15 +452,17 @@ } #----------------------------------------------------------------- -# create_datatype_cache +# create_service_cache #----------------------------------------------------------------- -=head2 create_datatype_cache +=head2 create_service_cache -Create the datatype cache. This will over write any pre-existing +Create the service cache. This will over write any pre-existing cache that it finds. -Throw an exception if something bad happens ... TODO explain this better +Throw an exception if any of the following occurs: + * A SOAP error as a result of calling the registry + * Problems writing to the cache directory =cut From kawas at dev.open-bio.org Tue Jul 24 18:25:40 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 24 Jul 2007 18:25:40 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707242225.l6OMPegZ020416@dev.open-bio.org> kawas Tue Jul 24 18:25:40 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv20380/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: more error checking added moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:29:38 1.3 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 22:25:40 1.4 @@ -312,8 +312,7 @@ my $xml = $soap->retrieveObjectNames( )->result; # create cache dirs as needed - $self->create_cache_dirs; - + $self->create_cache_dirs; my $file = File::Spec->catfile ($self->cachedir, $self->_clean ($self->_endpoint), DATATYPES_CACHE, @@ -322,7 +321,9 @@ or $self->throw ("Can't open file '$file' for writing: $!"); print FILE $xml; close FILE; - + + $LOG->debug("Saving the '". LIST_FILE . "' file."); + # 2-> foreach datatype store 'retrieveObjectDefinition' my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($xml); @@ -335,6 +336,7 @@ $name END + $LOG->debug("Processing the datatype, '$name'."); $xml = $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; $file = File::Spec->catfile ($self->cachedir, @@ -377,9 +379,16 @@ DATATYPES_CACHE))) { $self->throw("Datatype cache doesn't exist, so I can't update it. Please create a datatype cache first!"); } - + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + LIST_FILE))) { + $self->throw("Datatypes LIST_FILE doesn't exist, so I can't update the cache. Please create a datatype cache first!"); + } # steps: # read in the LIST file and extract lsids for all datatypes + $LOG->debug("Reading the cached '" . LIST_FILE ."'."); my $file = File::Spec->catfile ($self->cachedir, $self->_clean ($self->_endpoint), DATATYPES_CACHE, @@ -392,6 +401,7 @@ my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); $old_datatypes{$name} = $lsid; } + $LOG->debug("Retrieving an up to date '". LIST_FILE ."'."); # get the new LIST file and extract lsids for all datatypes my $soap = SOAP::Lite->uri($self->_namespace) @@ -416,6 +426,7 @@ foreach my $dt (keys %new_datatypes) { next unless !$old_datatypes{$dt} or $old_datatypes{$dt} ne $new_datatypes{$dt}; push @changed_datatypes, $dt; + $LOG->debug("The datatype, '$dt', seems to have been modified."); } # if their where changes, save new LIST file over the old one and get changes @@ -438,6 +449,8 @@ $name END + + $LOG->debug("Updating the datatype, '$name'."); $xml = $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; $file = File::Spec->catfile ($self->cachedir, @@ -550,6 +563,14 @@ SERVICES_CACHE))) { $self->throw("Services cache doesn't exist, so I can't update it. Please create a services cache first!"); } + + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + LIST_FILE))) { + $self->throw("Services LIST_FILE doesn't exist, so I can't update the cache. Please create a services cache first!"); + } # steps: # read in the LIST file and extract lsids for all datatypes @@ -1210,6 +1231,7 @@ $dir = File::Spec->catdir($dir, $part); next if -d $dir or -e $dir; mkdir( $dir ) || $self->throw("Error creating caching directory '".$dir."':\n$!"); + $LOG->debug("creating the directory, '$dir'."); } } } From gordonp at dev.open-bio.org Fri Jul 27 17:44:22 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 17:44:22 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707272144.l6RLiM5j026320@dev.open-bio.org> gordonp Fri Jul 27 17:44:22 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv26284/src/main/org/biomoby/shared/data Modified Files: MobyDataObject.java Log Message: Made articleName searching deeper: if encapsulating simple tag doesn't name an item (e.g. when in a collection), try grabbing the name from the object element itself moby-live/Java/src/main/org/biomoby/shared/data MobyDataObject.java,1.18,1.19 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/07/06 22:11:01 1.18 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/07/27 21:44:21 1.19 @@ -256,6 +256,11 @@ // A top level object whose name is in the enclosing simple tag if(p != null && (p instanceof Element) && ((Element) p).getTagName().equals(MobyTags.SIMPLE)){ name = MobyPrefixResolver.getAttr((Element) p, MobyTags.ARTICLENAME); + if(name != null && name.length() > 0){ + return name; + } + // If the simple doesn't have a name, grab the name from the child tag + name = MobyPrefixResolver.getAttr(e, MobyTags.ARTICLENAME); return name == null ? "" : name; } // Part of a composite, subobject's name is in its own tag From gordonp at dev.open-bio.org Fri Jul 27 17:45:13 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 17:45:13 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707272145.l6RLjDBZ026366@dev.open-bio.org> gordonp Fri Jul 27 17:45:13 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv26330/src/main/org/biomoby/shared/data Modified Files: MobyDataObjectSet.java Log Message: Fixed neaest-common-acestor determination algorithm when one object is shallow moby-live/Java/src/main/org/biomoby/shared/data MobyDataObjectSet.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2007/06/07 23:58:15 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2007/07/27 21:45:13 1.9 @@ -109,10 +109,11 @@ } else{ for(int i = 0; i < lineage.length; i++){ - if(!lineage[i].equals(objLineage[i])){ + if(i >= objLineage.length || !lineage[i].equals(objLineage[i])){ // start of different family tree, truncate common lineage here lineage = new MobyDataType[i]; System.arraycopy(objLineage, 0, lineage, 0, i); + break; //would happen anyway due to lineage resize, but let's make it explicit } } } From gordonp at dev.open-bio.org Fri Jul 27 23:38:41 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:38:41 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280338.l6S3cftx026754@dev.open-bio.org> gordonp Fri Jul 27 23:38:41 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26718/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentGUI.java Log Message: Clipboard now always visible, even at startup moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentGUI.java,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/06/16 19:34:36 1.12 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/07/28 03:38:41 1.13 @@ -211,6 +211,8 @@ dataRecorder, status); getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER); + tabbedPane.add(clipboard); + clipboard.init(); settingsGUI = new SeahawkOptionsGUI(this); } @@ -299,12 +301,13 @@ catch(TransformerConfigurationException tce){ MobyContentPane tab = createTab("Initialization Error"); tab.failed("Initialization Error"); - tab.getDisplay().setText("Cannot continue: could not create XML transformer (either stylesheet has an error, or no JAXT implementation is available"); - logger.error("Cannot continue: could not create XML transformer: " + tce); + tab.getDisplay().setText("Cannot continue: could not create XML transformer (either stylesheet has an error, or no JAXT implementation is available\n"); + logger.error("Cannot continue: could not create XML transformer: " + tce); + tce.printStackTrace(); } setVisible(true); - tabbedPane.add(clipboard); + //tabbedPane.add(clipboard); int clipboardIndex = tabbedPane.indexOfComponent(clipboard); if(clipboardIndex != -1){ tabbedPane.setToolTipTextAt(clipboardIndex, CLIPBOARD_TAB_TOOLTIP); From gordonp at dev.open-bio.org Fri Jul 27 23:40:19 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:40:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280340.l6S3eJjQ026820@dev.open-bio.org> gordonp Fri Jul 27 23:40:18 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26784/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentPane.java Log Message: Added article name to popup data display, other minor edits moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentPane.java,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2007/06/18 20:01:12 1.12 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2007/07/28 03:40:18 1.13 @@ -218,7 +218,7 @@ boolean unformatted = false; // It's XML that needs to be transformed to HTML - if(urlString.lastIndexOf(".xml") == urlString.length()-4 || + if(urlString.endsWith(".xml") || "text/xml".equals(urlCon.getContentType())){ editorPane.setContentType("text/html"); isContentsXML = true; @@ -792,7 +792,8 @@ String query = targetURL.getQuery(); String mobyID = null; String mobyString = null; - + String mobyName = ""; + MobyDataObject mobyData = null; // extract the ID or string value @@ -809,7 +810,7 @@ mobyID = ""; } } - else if(mobyString == null && token.startsWith("string=") && token.length() > 7){ + else if(mobyString == null && token.startsWith("string=") && token.length() >= 7){ if(token.length() > 7){ mobyString = token.substring(7); } @@ -817,6 +818,14 @@ mobyString = ""; } } + else if(mobyName.length() == 0 && token.startsWith("name=") && token.length() >= 5){ + if(token.length() > 5){ + mobyName = token.substring(5); + } + else{ + mobyName = ""; + } + } else{ logger.warn("Warning: unrecognized or duplicate query part '" + token + "' in moby link " + targetURL); @@ -826,10 +835,10 @@ } if(mobyString != null){ - mobyData = new MobyDataString("", mobyString, SeahawkOptions.getRegistry()); + mobyData = new MobyDataString(mobyName, mobyString, SeahawkOptions.getRegistry()); } else{ - mobyData = new MobyDataObject("", SeahawkOptions.getRegistry()); + mobyData = new MobyDataObject(mobyName, SeahawkOptions.getRegistry()); } mobyData.addNamespace(MobyNamespace.getNamespace(namespace, SeahawkOptions.getRegistry())); @@ -1094,6 +1103,6 @@ public void keyTyped(KeyEvent e){} public void paste(){ - getTransferHandler().importData(editorPane, java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this)); + getTransferHandler().importData(this, java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this)); } } From gordonp at dev.open-bio.org Fri Jul 27 23:42:00 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:42:00 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280342.l6S3g0Wa026864@dev.open-bio.org> gordonp Fri Jul 27 23:42:00 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26828/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentClipboard.java Log Message: Made the clipboard 'smart', pasted data is automatically converted to MOBY Objects and append to clipboard collection moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentClipboard.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2007/06/08 14:04:27 1.4 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2007/07/28 03:42:00 1.5 @@ -1,16 +1,15 @@ package ca.ucalgary.seahawk.gui; -import ca.ucalgary.seahawk.util.DataRecorder; +import ca.ucalgary.seahawk.services.MobyClient; +import ca.ucalgary.seahawk.util.*; import org.biomoby.client.MobyRequestEventHandler; +import org.biomoby.shared.MobyDataType; import org.biomoby.shared.data.*; +import org.biomoby.shared.parser.MobyTags; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.JTabbedPane; +import javax.swing.*; import javax.xml.transform.Transformer; import javax.xml.parsers.DocumentBuilder; @@ -42,6 +41,7 @@ private File clipboardFile; private MobyDataJob query; // lump all data into one query private MobyDataObjectSet collection; // lump all data into one collection + private String previousImportDataType = null; // Clipboard editing variables private JMenuItem deleteDataPopupItem; @@ -82,7 +82,12 @@ return; } clipboardFile.deleteOnExit(); - + + // The dfeault is to open a new tab when contents is transfered (dropped/pasted) onto the tab, + // we want to override that behaviour to a collation for the clipboard + setTransferHandler(new FileAndTextTransferHandler(cGUI, false)); // false = open data in current tab + editorPane.setTransferHandler(getTransferHandler()); + sGUI.setClipboard(this); } @@ -112,6 +117,9 @@ // Only process if the passed in data is one of the top level collection elements // (i.e. don't delete subparts of object) if(!(mdi instanceof MobyDataObject) || !collection.contains(mdi)){ + mdi.setXmlMode(MobyDataInstance.SERVICE_XML_MODE); + System.err.println("Skipping " + mdi.toXML()); + mdi.setXmlMode(MobyDataInstance.CENTRAL_XML_MODE); return; } @@ -156,6 +164,10 @@ * @param mdi the data to be added to the main clipboard collection */ public void addCollectionData(MobyDataInstance mdi){ + addCollectionData(mdi, true); + } + + public void addCollectionData(MobyDataInstance mdi, boolean updateDisplay){ if(mdi == null){ logger.warn("Cannot add null object to the clipboard."); return; @@ -177,9 +189,125 @@ return; } + if(updateDisplay){ + updateDisplay(); + } + } + + /** + * Objects in the content instance will be flattened into a list + * and appended to the current contents of the collection. + */ + public void addCollectionData(MobyContentInstance mci){ + for(MobyDataJob job: mci.values()){ + for(MobyDataInstance data: job.getPrimaryData()){ + addCollectionData(data, false); //false == don't update display + } + } updateDisplay(); } + /** + * Attempts to add data from the given URL as MOBY objects (converting if necessary). + * The conversion is "smart", and so if you have 2 DNASequences on the clipboard + * already, it will try to extract DNASequences from the URL data first, then other + * types. + */ + public void addCollectionData(URL u){ + try{ + MobyContentInstance mobyContents = + MobyUtils.convertURLtoMobyBinaryData(servicesGUI.getMobyClient(), u); + if(mobyContents != null){ + addCollectionData(mobyContents); + return; + } + } catch(Exception e){ + logger.warn("Could not transform binary file ("+u+"): " + e); + } + + // Not binary, see if it's text that's convertible to MOBY data + MobyClient client = servicesGUI.getMobyClient(); + if(client == null){ + logger.warn("Could not get MOBY client from MOBY services GUI, " + + "cannot transform incoming clipboard data to MOBY objects"); + } + String urlContents = null; + try{ + urlContents = HTMLUtils.getURLContents(u); + } catch(Exception e){ + logger.warn("Could not read contents of the URL to import to the clipboard ("+u+"):" +e); + return; + } + + MobyDataType targetDataType = null; + if(collection != null){ + targetDataType = collection.getDataType(); + } + MobyDataObject[] mobyDataFound = client.getMobyObjects(urlContents, targetDataType); + // If only one data available, use it + if(mobyDataFound.length == 1){ + addCollectionData(mobyDataFound[0]); + return; + } + // If no data available, try a more general object finding query + else if(mobyDataFound.length == 0){ + // If the previous transformation attempt was for the base Object, there's + // nothing more to search for, just treat the data as a string. + if(targetDataType == null || MobyTags.MOBYOBJECT.equals(targetDataType.getName())){ + addCollectionData(new MobyDataString(urlContents)); + return; + } + mobyDataFound = client.getMobyObjects(urlContents); + if(mobyDataFound.length == 1){ + addCollectionData(mobyDataFound[0]); + return; + } + else if(mobyDataFound.length == 0){ + addCollectionData(new MobyDataString(urlContents)); + return; + } + } + // Otherwise we need to ask the user what data to import ("Paste as...") + // Implicitly...mobyDataFound.length > 1 + String[] selectionValues = new String[mobyDataFound.length]; + for(int i = 0; i < mobyDataFound.length; i++){ + selectionValues[i] = mobyDataFound[i].getDataType().getName(); + if(MobyTags.MOBYOBJECT.equals(selectionValues[i]) && + mobyDataFound[i].getPrimaryNamespace() != null){ + selectionValues[i] += " (" + mobyDataFound[i].getPrimaryNamespace().getName() + ")"; + } + } + // Sort alphabetically + //Arrays.sort(selectionValues); + String initialSelectionValue = selectionValues[0]; + if(previousImportDataType != null){ + for(String selectionValue: selectionValues){ + if(previousImportDataType.equals(selectionValue)){ + initialSelectionValue = selectionValue; + break; + } + } + } + String selection = (String) JOptionPane.showInputDialog(this, + "Paste data as...", + "Data import choice", + JOptionPane.PLAIN_MESSAGE, + (Icon) null, + selectionValues, + initialSelectionValue); + if(selection == null){ + logger.warn("No data type for import selected, abandoning import"); + return; + } + for(int i = 0; i < selectionValues.length; i++){ + if(selection.equals(selectionValues[i])){ + addCollectionData(mobyDataFound[i]); + previousImportDataType = selection; + return; + } + } + } + public boolean hasXMLSource(){ return true; } From gordonp at dev.open-bio.org Fri Jul 27 23:43:24 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:43:24 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280343.l6S3hOFX026908@dev.open-bio.org> gordonp Fri Jul 27 23:43:24 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26872/src/main/ca/ucalgary/seahawk/gui Modified Files: FileAndTextTransferHandler.java Log Message: Added support for passing data to the clipboard for appending, rather than just opening a new tab with the pasted data moby-live/Java/src/main/ca/ucalgary/seahawk/gui FileAndTextTransferHandler.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2007/06/08 14:04:27 1.6 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2007/07/28 03:43:24 1.7 @@ -25,9 +25,18 @@ public class FileAndTextTransferHandler extends TransferHandler { private DataFlavor fileFlavor, stringFlavor; private MobyContentGUI gui; + private boolean openDataInNewTab; + /** + * By default, opens pasted data in a new tab of the GUI + */ public FileAndTextTransferHandler(MobyContentGUI mcg) { + this(mcg, true); + } + + public FileAndTextTransferHandler(MobyContentGUI mcg, boolean openNewDataInNewTab) { gui = mcg; + openDataInNewTab = openNewDataInNewTab; fileFlavor = DataFlavor.javaFileListFlavor; stringFlavor = DataFlavor.stringFlavor; } @@ -38,6 +47,20 @@ return false; } + // The clipboard is a special case: we want to append data, + // not replace (also assuming you told us not to open data in a new tab). + MobyContentClipboard clipboard = null; + if(!openDataInNewTab){ + for(Component container = c; + container != null; + container = container.getParent()){ + if(container instanceof MobyContentClipboard){ + clipboard = (MobyContentClipboard) container; + break; + } + } + } + // Should be done in another thread to not block UI try { if (hasFileFlavor(t.getTransferDataFlavors())) { @@ -48,12 +71,22 @@ // Was it a shortcut file after all? if(u != null){ System.err.println("Dropped item appears to be a URL shortcut..."); - gui.loadPaneFromURL(u, true); + if(clipboard != null){ + clipboard.addCollectionData(u); + } + else{ + gui.loadPaneFromURL(u, openDataInNewTab); + } } // Any other type of file is loaded as-is else{ System.err.println("Dropped item appears to be a file..."); - gui.loadPaneFromURL(file.toURI().toURL(), true); + if(clipboard != null){ + clipboard.addCollectionData(file.toURI().toURL()); + } + else{ + gui.loadPaneFromURL(file.toURI().toURL(), openDataInNewTab); + } } } return true; @@ -74,16 +107,33 @@ } if(u != null){ System.err.println("Dropped item appears to be a URL..."); - gui.loadPaneFromURL(u, true); + if(clipboard != null){ + clipboard.addCollectionData(u); + } + else{ + gui.loadPaneFromURL(u, openDataInNewTab); + } return true; } + // For the purposes of the clipboard, if it's not a URL, we want to parse + // the text fopr MOBY data, rather than display the HTML or RTF, etc. + if(clipboard != null){ + boolean PLAIN_TEXT = true; + text = convertToString(t, PLAIN_TEXT); + } + // If the text looks like a MOBY XML payload, be nice and create // the proper object to load MobyContentInstance content = HTMLUtils.checkForMobyXML(text); if(content != null){ System.err.println("Dropped item appears to be moby xml..."); - gui.loadPaneFromObject(content, true); + if(clipboard != null){ + clipboard.addCollectionData(content); + } + else{ + gui.loadPaneFromObject(content, openDataInNewTab); + } return true; } @@ -117,7 +167,12 @@ out.write(text.getBytes()); } out.close(); - gui.loadPaneFromURL(savedFile.toURI().toURL(), true); + if(clipboard != null){ + clipboard.addCollectionData(savedFile.toURI().toURL()); + } + else{ + gui.loadPaneFromURL(savedFile.toURI().toURL(), openDataInNewTab); + } return true; } else{ From gordonp at dev.open-bio.org Fri Jul 27 23:45:31 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:45:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280345.l6S3jVHx026974@dev.open-bio.org> gordonp Fri Jul 27 23:45:31 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util In directory dev.open-bio.org:/tmp/cvs-serv26938/src/main/ca/ucalgary/seahawk/util Modified Files: HTMLUtils.java Log Message: Made binary data encapsulation more robust moby-live/Java/src/main/ca/ucalgary/seahawk/util HTMLUtils.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java 2007/06/08 14:04:27 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java 2007/07/28 03:45:31 1.4 @@ -8,50 +8,65 @@ import java.io.*; import java.net.*; - +import java.util.Vector; public class HTMLUtils{ public final static String BINARY_DATA_LABEL = "[binary data not shown]"; - public final static String ACCEPTABLE_IMAGE_DATATYPE = "WebFormatImage"; //from the ontology + public final static String ACCEPTABLE_IMAGE_DATATYPE = "WebFormatImage"; //from the ontology, should eventually be configurable public static String encapsulateBinaryData(URL sourceMobyData, String html) throws Exception{ MobyContentInstance dataPackage = MobyDataUtils.fromXMLDocument(sourceMobyData); // Look for binary data and replace it with an image ref (if its an image // displayable in our viewer), or simply "(binary data)". for(MobyDataJob job: dataPackage.values()){ - for(MobyDataInstance data: job.values()){ - if(data instanceof MobyDataBytes){ - MobyDataBytes binaryMobyObject = (MobyDataBytes) data; - //System.err.println("Replacing binary data in display of "+binaryMobyObject.getName()); - - String encodedData = binaryMobyObject.get(MobyDataBytes.ENCODED_MEMBER_NAME) - .getValue().toString(); - if(html.indexOf(encodedData) == -1){ - System.err.println("Could not find the encoded data in the html given!!!"); - } - - // if an image, save and show it - if(binaryMobyObject.getDataType().inheritsFrom(ACCEPTABLE_IMAGE_DATATYPE)){ - String imgSuffix = binaryMobyObject.getDataType().getName(); - if(imgSuffix.length() < 3){ - imgSuffix = ".img"; + for(MobyDataInstance primary: job.values()){ + Iterable values = null; + if(primary instanceof MobyDataObjectSet || + primary instanceof MobyDataObjectVector){ + values = (Iterable) primary; + } + else if(primary instanceof MobyDataObject){ + values = new Vector(); + ((Vector) values).add((MobyDataObject) primary); + } + else{ + // ignore secondaries, they can't be binary + continue; + } + for(MobyDataObject data: values){ + if(data instanceof MobyDataBytes){ + MobyDataBytes binaryMobyObject = (MobyDataBytes) data; + //System.err.println("Replacing binary data in display of "+binaryMobyObject.getName()); + + String encodedData = binaryMobyObject.get(MobyDataBytes.ENCODED_MEMBER_NAME) + .getValue().toString(); + if(html.indexOf(encodedData) == -1){ + System.err.println("Could not find the encoded data in the html given!!!"); } + + // if an image, save and show it + if(binaryMobyObject.getDataType().inheritsFrom(ACCEPTABLE_IMAGE_DATATYPE)){ + String imgSuffix = binaryMobyObject.getDataType().getName(); + if(imgSuffix.length() < 3){ + imgSuffix = ".img"; + } + else{ + imgSuffix = "."+imgSuffix.substring(0, 3).toLowerCase(); + } + File imageFile = File.createTempFile("seahawkSavedImage", imgSuffix); + imageFile.deleteOnExit(); + + FileOutputStream fos = new FileOutputStream(imageFile); + fos.write(binaryMobyObject.getBytes()); + fos.close(); + + html = html.replace(encodedData, "
"); + } + // Otherwise put a placeholder else{ - imgSuffix = "."+imgSuffix.substring(0, 3).toLowerCase(); + html = html.replace(encodedData, BINARY_DATA_LABEL); } - File imageFile = File.createTempFile("seahawkSavedImage", imgSuffix); - imageFile.deleteOnExit(); - - FileOutputStream fos = new FileOutputStream(imageFile); - fos.write(binaryMobyObject.getBytes()); - fos.close(); - - html = html.replace(encodedData, "
"); - } - // Otherwise put a placeholder - else{ - html = html.replace(encodedData, BINARY_DATA_LABEL); } } } @@ -154,9 +169,13 @@ MobyContentInstance content = null; String xmltext = text; + if(xmltext.indexOf("??") == 0){ + xmltext = xmltext.substring(2); + } + // See if the xml needs unescaping (e.g. if preformatted HTML dropped from Firefox or Thunderbird) int preStart = xmltext.indexOf("")+1); @@ -196,10 +215,20 @@ } } catch(Exception e){ e.printStackTrace(); - System.err.println("This issue may be related to your choice of registry ("+ + System.err.println("This issue may or may not be related to your choice of registry ("+ (SeahawkOptions.getRegistry() == null ? "MOBY default" : SeahawkOptions.getRegistry().getSynonym()) +")"); + System.err.println(xmltext); } return content; } + + public static String getURLContents(URL u) throws Exception{ + StringBuffer buffer = new StringBuffer(); + LineNumberReader reader = new LineNumberReader(new InputStreamReader(u.openStream())); + for(String line = reader.readLine(); line != null; line = reader.readLine()){ + buffer.append(line); + } + return buffer.toString(); + } } From gordonp at dev.open-bio.org Fri Jul 27 23:46:16 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:46:16 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280346.l6S3kGPe027018@dev.open-bio.org> gordonp Fri Jul 27 23:46:16 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services In directory dev.open-bio.org:/tmp/cvs-serv26982/src/main/ca/ucalgary/seahawk/services Modified Files: MobyClient.java Log Message: Made less verbose moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyClient.java,1.15,1.16 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java 2007/06/28 16:45:44 1.15 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java 2007/07/28 03:46:16 1.16 @@ -586,13 +586,15 @@ /** * Using the regular expression mappings that have been set up, * maps a string using rules producing moby objects of the given type. + * @param targetDataType matches any data type if null, otherwise restricts returned items to those that are of (or inherit from) the given type */ public MobyDataObject[] getMobyObjects(String textData, MobyDataType targetDataType){ Vector objectVector = new Vector(); for(Pattern pattern: regexMap.keySet()){ MobyComplexBuilder rule = regexMap.get(pattern); - if(rule.getDataType().inheritsFrom(targetDataType)){ + if(targetDataType == null || + rule.getDataType().inheritsFrom(targetDataType)){ Matcher matcher = pattern.matcher(textData); while(matcher.find()){ @@ -1212,7 +1214,7 @@ throw new Exception("Cannot find definition of data type "+mobyDataType+ " in the ontology, therefore the rule cannot be properly parsed"); } - MobyRelationship[] memberRelationships = dataType.getChildren(); + MobyRelationship[] memberRelationships = dataType.getAllChildren(); String newRegexp = processRegExp(regexp, membersMap); Map captured = new HashMap(); @@ -1221,7 +1223,7 @@ String[] rule = membersMap.get(memberRelationship.getName()); if(rule == null){ System.err.println("Skipping HAS member "+memberRelationship.getName() + - " without a rule"); + " without an explicit rule (may be defined by inheritance?)"); continue; } Pattern pattern = Pattern.compile(newRegexp, Pattern.DOTALL | Pattern.COMMENTS); @@ -1268,10 +1270,10 @@ } // end for(group count) } // end if (member's relationship is HAS) else{ - System.err.println("Relationship for member " + memberRelationship.getName() + " of "+ mobyDataType + - "is *not* HAS"); + //System.err.println("Relationship for member " + memberRelationship.getName() + " of "+ mobyDataType + + // "is *not* HAS"); } - } //end for(member replationships) + } //end for(member relationships) return newRegexp; } From gordonp at dev.open-bio.org Fri Jul 27 23:47:07 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:47:07 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280347.l6S3l78B027062@dev.open-bio.org> gordonp Fri Jul 27 23:47:07 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources In directory dev.open-bio.org:/tmp/cvs-serv27026/src/main/ca/ucalgary/seahawk/resources Modified Files: mobyBuilderRules.xml Log Message: Simplified DNA/AA MOB rules moby-live/Java/src/main/ca/ucalgary/seahawk/resources mobyBuilderRules.xml,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml 2007/06/08 14:04:27 1.5 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml 2007/07/28 03:47:07 1.6 @@ -6,24 +6,24 @@ - (\N*\s*(\N{10,}(?:\x20|\r|\t|\n)?)+\N*) + \N*\s*(?:\N{10,}(?:\x20|\r|\t|\n)*)+\N* '' - $1 - string-length('$1') + $0 + string-length('$0') - (\P*\s*(\P{10,}(?:\x20|\r|\t|\n)?)+\P*) + \P*\s*(?:\P{10,}(?:\x20|\r|\t|\n)*)+\P* '' - $1 - string-length('$1') + $0 + string-length('$0') From gordonp at dev.open-bio.org Fri Jul 27 23:47:41 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:47:41 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280347.l6S3lfTS027106@dev.open-bio.org> gordonp Fri Jul 27 23:47:41 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources In directory dev.open-bio.org:/tmp/cvs-serv27070/src/main/ca/ucalgary/seahawk/resources Modified Files: moby2HTML.xsl Log Message: Added articleName support for moby URLs moby-live/Java/src/main/ca/ucalgary/seahawk/resources moby2HTML.xsl,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/moby2HTML.xsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/moby2HTML.xsl 2007/06/16 00:28:57 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/moby2HTML.xsl 2007/07/28 03:47:41 1.4 @@ -218,22 +218,17 @@ - ID : () + ID : () - ID : ():
+ String : ():
- - - + :
@@ -255,8 +250,9 @@ - - Collection of data elements:
+ + + Collection of data elements

  1. From gordonp at dev.open-bio.org Fri Jul 27 23:50:47 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:50:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280350.l6S3olwd027172@dev.open-bio.org> gordonp Fri Jul 27 23:50:47 EDT 2007 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv27136/xmls Modified Files: seahawkBuild.xml Log Message: Change to reflect move of splasher to own package (done to allow independent splasher and main jar loading) moby-live/Java/xmls seahawkBuild.xml,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2007/06/16 00:44:51 1.10 +++ /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2007/07/28 03:50:47 1.11 @@ -4,7 +4,7 @@ - + @@ -13,12 +13,12 @@ - - + + - - + + From gordonp at dev.open-bio.org Mon Jul 30 09:54:06 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 30 Jul 2007 09:54:06 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707301354.l6UDs6GN005665@dev.open-bio.org> gordonp Mon Jul 30 09:54:05 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services In directory dev.open-bio.org:/tmp/cvs-serv5629/src/main/ca/ucalgary/services Modified Files: ACDService.java Log Message: Updated library path inclusion for EMBOSS moby-live/Java/src/main/ca/ucalgary/services ACDService.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/ACDService.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/ACDService.java 2007/04/18 15:53:58 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/ACDService.java 2007/07/30 13:54:05 1.4 @@ -102,7 +102,7 @@ "Valid choices from this run are:" + paramChoices); } - // Transform the buts of binary data into a MOBY object or collection + // Transform the bits of binary data into a MOBY object or collection MobyDataInstance mdi = null; try{ mdi = mobyClient.getMobyObject(resultParts, mobyOutputTemplate); @@ -307,15 +307,14 @@ * @return the standard output of the command */ private String runProgram(MobyDataJob request, String[] command, File workingDir, final byte[] input) throws Exception{ - // TODO: ensure $embossRootDirName/lib is in the LD_LIBRARY_PATH, - // what is the equivalent in Windows? - //for(String cmdpart: command){ - // System.err.print(cmdpart+" "); - //} - //System.err.println(""); + // Ensure $embossRootDirName/lib is in the LD_LIBRARY_PATH, + // what is the equivalent in Windows? Windows searches just PATH... + String libDir = embossRootDirName+File.separator+"lib"; final Process process = runtime.exec(command, new String[]{"EMBOSS="+embossRootDirName, - "EMBOSS_ACDROOT="+acdRootDirName}, + "EMBOSS_ACDROOT="+acdRootDirName, + "LD_LIBRARY_PATH="+libDir, + "PATH="+libDir}, workingDir); final OutputStream stdin = process.getOutputStream(); final InputStream stderr = process.getErrorStream(); From pieter at dev.open-bio.org Tue Jul 31 08:29:16 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Tue, 31 Jul 2007 08:29:16 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707311229.l6VCTGoq009943@dev.open-bio.org> pieter Tue Jul 31 08:29:15 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv9908 Modified Files: Central.pm Log Message: Fixed small type in documentation for MOBY::Client::Central.pm moby-live/Perl/MOBY/Client Central.pm,1.148,1.149 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.148 retrieving revision 1.149 diff -u -r1.148 -r1.149 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/06/27 15:47:33 1.148 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/07/31 12:29:15 1.149 @@ -1305,7 +1305,7 @@ Usage : $types = $MOBY->retrieveServiceTypesFull(%args) Function : get all details of all service types - Returns : hashref of $types{$type} = {definition => "definition", + Returns : hashref of $types{$type} = {Description => "definition", authURI => "authority.uri.here", contactEmail => "email at addy.here"} Args : registry => $reg_name: name of registry you wish to retrieve from (optional) From pieter at dev.open-bio.org Tue Jul 31 09:48:31 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Tue, 31 Jul 2007 09:48:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707311348.l6VDmVKQ010144@dev.open-bio.org> pieter Tue Jul 31 09:48:30 EDT 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv10105 Modified Files: DataClassOntology.html SecondaryArticle.html Log Message: Updated documentation for valid boolean values in primitives and secondaries. moby-live/Docs/MOBY-S_API DataClassOntology.html,1.9,1.10 SecondaryArticle.html,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/DataClassOntology.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/DataClassOntology.html 2007/02/22 16:22:24 1.9 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/DataClassOntology.html 2007/07/31 13:48:30 1.10 @@ -55,11 +55,11 @@
    - -

    -The MOBY Data Class Ontology

    +

    The MOBY Data Class Ontology

    +

    "Standard" Objects

    + In the BioMOBY system, all datatypes (Classes) are defined in an ontology, where each node represents a named Class, and each arc represents one of two @@ -69,13 +69,7 @@ "Object" Class, and (with the exception of the special-case primitives) may contain other objects which themselves inherit -from the "Object" Class. This includes all primitive datatypes such -as integers (class Integer), floating point numbers (class Float), -dates and times (DateTime), -and strings (class String). The class DateTime -uses the W3C profile of the ISO-8601 specification for -specifying dates and times.

    +from the "Object" Class.

    Given this structure, the relationship between any two objects can be described in an RDF triple (subject1, predicate, subject2). @@ -94,21 +88,21 @@

       <Foo namespace="" id="" >

    - -Another example of direct inheritence from the Object class is found -in the classes representing primitives such as integers, floating -point number, strings, and so on. The following RDF triple describes -the Integer object: -

      Integer - ISA - Object
    -and as XML takes on the following structure: -
    -  <Integer namespace="" id="" >966754</Integer>
    -
    -

    +

    "Primitive" Objects

    + +The BioMOBY Class ontology contains five special case primitives: + +

    -Notice, these primitive types are the only cases where the content -of the element is meant to be interpreted by the client or service. +These primitive types are special as they are the only cases where the content +of an element is meant to be interpreted by the client or service. New classes MUST NOT inherit from the Primitive Classes. To obtain content in another class, you must be a container of a primitive class. The two relationship types - HASA and HAS - are used @@ -118,7 +112,17 @@ parent object. HASA indicates that a single instance of the object is contained, while HAS indicates that multiple instances of the object are contained. + +The following RDF triple describes +the Integer object: +

      Integer - ISA - Object
    + +and as XML takes on the following structure: +
    +  <Integer namespace="" id="" >966754</Integer>
    +

    +

    For example, one might imagine a PlainText Object Class that needs to contain some stringified content. This @@ -136,8 +140,21 @@ </moby:String> </moby:PlainText> +

    +

    +The DateTime class uses the +W3C profile of the ISO-8601 specification +for specifying dates and times. +

    +

    +The Boolean class uses the +XML schema definition for valid boolean values. +Hence BioMOBY clients and services can send one of the following literals {true, false, 1, 0} +and must understand all of {true, false, 1, 0}. Other commonly used boolean values like {T,F,TRUE,FALSE} etc. +are not supported and illegal in BioMOBY lingua. +

    =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/SecondaryArticle.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/SecondaryArticle.html 2006/11/21 23:04:27 1.9 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/SecondaryArticle.html 2007/07/31 13:48:30 1.10 @@ -117,8 +117,8 @@

    The components of the Parameter specification are:

      -
    • datatype - one of Integer, Boolean, Float, - String, DateTime, which specifies the type of data +
    • datatype - one of Integer, Boolean, Float, + String, DateTime, which specifies the type of data involved
    • description - a description of this parameter.
    • default - an optional default value, in case none is specified
    • @@ -131,6 +131,20 @@

    +

    +DateTime secondaries use the +W3C profile of the ISO-8601 specification +for specifying dates and times. +

    + +

    +Boolean secondaries use the +XML schema definition for valid boolean values. +Hence BioMOBY clients and services can send one of the following literals {true, false, 1, 0} +and must understand all of {true, false, 1, 0}. Other commonly used boolean values like {T,F,TRUE,FALSE} etc. +are not supported and illegal in BioMOBY lingua. +

    +
    From kawas at dev.open-bio.org Tue Jul 31 13:51:42 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 31 Jul 2007 13:51:42 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707311751.l6VHpgQZ010457@dev.open-bio.org> kawas Tue Jul 31 13:51:42 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv10422/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: fixed the pod documentation moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 22:25:40 1.4 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/31 17:51:42 1.5 @@ -290,8 +290,9 @@ cache that it finds. Throw an exception if any of the following occur: - * There is a SOAP error calling the registry - * There were write errors on the cache directory or its contents + * There is a SOAP error calling the registry + * There were write errors on the cache directory or its contents + =cut sub create_datatype_cache { @@ -360,9 +361,9 @@ by relying on the LSID for the datatype. Throw an exception if any of the following occur: - * A cache to update doesn't exist - * There is a SOAP error calling the registry - * There were read/write errors on the cache directory or its contents + * A cache to update doesn't exist + * There is a SOAP error calling the registry + * There were read/write errors on the cache directory or its contents =cut @@ -474,8 +475,8 @@ cache that it finds. Throw an exception if any of the following occurs: - * A SOAP error as a result of calling the registry - * Problems writing to the cache directory + * A SOAP error as a result of calling the registry + * Problems writing to the cache directory =cut @@ -758,7 +759,6 @@ is defined by the C (and optionally by the C) parameters given in the constructor of this instance. - =cut sub get_datatype_names { @@ -823,6 +823,7 @@ An argument is one or more data types (C) whose related data types are looked for. + =cut sub get_related_types { @@ -912,6 +913,7 @@ @services = $cache->get_services ('samples.jmoby.net', qw ( HelloBiomobyWorld Mabuhay )); or + @services = $cache->get_services ('samples.jmoby.net', 'Mabuhay'); =cut From jmrc at dev.open-bio.org Wed Jul 18 06:47:30 2007 From: jmrc at dev.open-bio.org (José Manuel Rodríguez Carrasco) Date: Wed, 18 Jul 2007 10:47:30 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181047.l6IAlONf028391@dev.open-bio.org> jmrc Wed Jul 18 06:47:24 EDT 2007 Update of /home/repository/moby/moby-live/Perl In directory dev.open-bio.org:/tmp/cvs-serv28328/Perl Modified Files: Makefile.PL Log Message: Description: Perl/MOBY/Makefile.PL We try to add WSRF::Lite version (0.8.2.1) but it is not declared in the proper way there. Perl/MOBY/Central.pm The WSDL template has been remade for asynchronous services. In the last version, it had a mix of RPC/encoded and document/literal in the only binding it had. The solution has been distributing the operations on two disjunctive port types and bindings, one for RPC/encoded operations and the other for document/literal operations. In that way, the service has two ports, one for MOBY and the other for WSRF, both of them using the same endpoint. The namespaces have been modified for the communication operations (SOAP, WSRF, and MOBY). Perl/MOBY/Async/* The methods have been modified to use RPC/encoded for both input and output. They accept namespaces from new asynchronous WSDL. Date: 2007-07-18 Developers: Jose Maria Fernandez (jmfernandez at cnio.es), Jose Manuel Rodriguez (jmrodriguez at cnio.es) - INB GN2 (CNIO, Spain). moby-live/Perl Makefile.PL,1.25,1.26 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/Makefile.PL,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- /home/repository/moby/moby-live/Perl/Makefile.PL 2007/02/07 01:21:24 1.25 +++ /home/repository/moby/moby-live/Perl/Makefile.PL 2007/07/18 10:47:24 1.26 @@ -153,6 +153,7 @@ # Database stuff required only for local registry, but notify user if missing anyway. 'DBI' => 0.01, 'DBD::mysql' => 0.01, + # 'WSRF::Lite' => '0.8.2.1', but it is not declared in the proper way there 'WSRF::Lite' => '', 'Test::Simple' => 0.44, 'XML::DOM' => '', From jmrc at dev.open-bio.org Wed Jul 18 06:47:35 2007 From: jmrc at dev.open-bio.org (José Manuel Rodríguez Carrasco) Date: Wed, 18 Jul 2007 10:47:35 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181047.l6IAlOlA028409@dev.open-bio.org> jmrc Wed Jul 18 06:47:24 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv28328/Perl/MOBY Modified Files: Central.pm Log Message: Description: Perl/MOBY/Makefile.PL We try to add WSRF::Lite version (0.8.2.1) but it is not declared in the proper way there. Perl/MOBY/Central.pm The WSDL template has been remade for asynchronous services. In the last version, it had a mix of RPC/encoded and document/literal in the only binding it had. The solution has been distributing the operations on two disjunctive port types and bindings, one for RPC/encoded operations and the other for document/literal operations. In that way, the service has two ports, one for MOBY and the other for WSRF, both of them using the same endpoint. The namespaces have been modified for the communication operations (SOAP, WSRF, and MOBY). Perl/MOBY/Async/* The methods have been modified to use RPC/encoded for both input and output. They accept namespaces from new asynchronous WSDL. Date: 2007-07-18 Developers: Jose Maria Fernandez (jmfernandez at cnio.es), Jose Manuel Rodriguez (jmrodriguez at cnio.es) - INB GN2 (CNIO, Spain). moby-live/Perl/MOBY Central.pm,1.284,1.285 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.284 retrieving revision 1.285 diff -u -r1.284 -r1.285 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/06/14 13:44:52 1.284 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/07/18 10:47:24 1.285 @@ -4116,169 +4116,201 @@ $WSDL_ASYNC_TEMPLATE = < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + - - + + - - + + - - + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + END From jmrc at dev.open-bio.org Wed Jul 18 06:47:44 2007 From: jmrc at dev.open-bio.org (José Manuel Rodríguez Carrasco) Date: Wed, 18 Jul 2007 10:47:44 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181047.l6IAlPao028443@dev.open-bio.org> jmrc Wed Jul 18 06:47:24 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Async In directory dev.open-bio.org:/tmp/cvs-serv28328/Perl/MOBY/Async Modified Files: LSAE.pm Service.pm SimpleServer.pm WSRF.pm Log Message: Description: Perl/MOBY/Makefile.PL We try to add WSRF::Lite version (0.8.2.1) but it is not declared in the proper way there. Perl/MOBY/Central.pm The WSDL template has been remade for asynchronous services. In the last version, it had a mix of RPC/encoded and document/literal in the only binding it had. The solution has been distributing the operations on two disjunctive port types and bindings, one for RPC/encoded operations and the other for document/literal operations. In that way, the service has two ports, one for MOBY and the other for WSRF, both of them using the same endpoint. The namespaces have been modified for the communication operations (SOAP, WSRF, and MOBY). Perl/MOBY/Async/* The methods have been modified to use RPC/encoded for both input and output. They accept namespaces from new asynchronous WSDL. Date: 2007-07-18 Developers: Jose Maria Fernandez (jmfernandez at cnio.es), Jose Manuel Rodriguez (jmrodriguez at cnio.es) - INB GN2 (CNIO, Spain). moby-live/Perl/MOBY/Async LSAE.pm,1.3,1.4 Service.pm,1.7,1.8 SimpleServer.pm,1.3,1.4 WSRF.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/LSAE.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/Async/LSAE.pm 2007/04/02 12:13:32 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/LSAE.pm 2007/07/18 10:47:24 1.4 @@ -6,8 +6,14 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). =head1 DESCRIPTION @@ -277,11 +283,11 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @heartbeat_progress = ($lsae->getChildrenByTagName('heartbeat_progress'), $lsae->getChildrenByTagName('lsae:heartbeat_progress')); - my @percent_progress = ($lsae->getChildrenByTagName('percent_progress'), $lsae->getChildrenByTagName('lsae:percent_progress')); - my @state_changed = ($lsae->getChildrenByTagName('state_changed'), $lsae->getChildrenByTagName('lsae:state_changed')); - my @step_progress = ($lsae->getChildrenByTagName('step_progress'), $lsae->getChildrenByTagName('lsae:step_progress')); - my @time_progress = ($lsae->getChildrenByTagName('time_progress'), $lsae->getChildrenByTagName('lsae:time_progress')); + my @heartbeat_progress = ($lsae->getChildrenByTagName('heartbeat_progress')); + my @percent_progress = ($lsae->getChildrenByTagName('percent_progress')); + my @state_changed = ($lsae->getChildrenByTagName('state_changed')); + my @step_progress = ($lsae->getChildrenByTagName('step_progress')); + my @time_progress = ($lsae->getChildrenByTagName('time_progress')); if (scalar(@heartbeat_progress)) { $self->{type} = MOBY::Async::LSAE::LSAE_HEARTBEAT_PROGRESS_EVENT; } elsif (scalar(@percent_progress)) { @@ -307,7 +313,7 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - $self->{id} = $lsae->getAttribute('id') || $lsae->getAttribute('moby:id'); + $self->{id} = $lsae->getAttribute('id') || $lsae->getAttributeNS($WSRF::Constants::MOBY, 'id'); } return $self->{id}; } @@ -320,7 +326,7 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - $self->{timestamp} = $lsae->getAttribute('timestamp') || $lsae->getAttribute('moby:timestamp'); + $self->{timestamp} = $lsae->getAttribute('timestamp') || $lsae->getAttributeNS($WSRF::Constants::MOBY, 'timestamp'); } return $self->{timestamp}; } @@ -333,7 +339,7 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('message'), $lsae->getChildrenByTagName('lsae:message')); + my @message = ($lsae->getChildrenByTagName('message')); my $message = shift(@message); $self->{message} = $message->getFirstChild->nodeValue if ($message); } @@ -350,9 +356,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('percent_progress'), $lsae->getChildrenByTagName('lsae:percent_progress')); + my @message = ($lsae->getChildrenByTagName('percent_progress')); my $message = shift(@message); - $self->{percentage} = $message->getAttribute('percentage') || $message->getAttribute('moby:percentage'); + $self->{percentage} = $message->getAttribute('percentage'); } } return $self->{percentage}; @@ -368,9 +374,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('state_changed'), $lsae->getChildrenByTagName('lsae:state_changed')); + my @message = ($lsae->getChildrenByTagName('state_changed')); my $message = shift(@message); - $self->{previous_state} = $message->getAttribute('previous_state') || $message->getAttribute('moby:previous_state'); + $self->{previous_state} = $message->getAttribute('previous_state'); } } return $self->{previous_state}; @@ -386,9 +392,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('state_changed'), $lsae->getChildrenByTagName('lsae:state_changed')); + my @message = ($lsae->getChildrenByTagName('state_changed')); my $message = shift(@message); - $self->{new_state} = $message->getAttribute('new_state') || $message->getAttribute('moby:new_state'); + $self->{new_state} = $message->getAttribute('new_state'); } } return $self->{new_state}; @@ -404,9 +410,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('step_progress'), $lsae->getChildrenByTagName('lsae:step_progress')); + my @message = ($lsae->getChildrenByTagName('step_progress')); my $message = shift(@message); - $self->{total_steps} = $message->getAttribute('total_steps') || $message->getAttribute('moby:total_steps'); + $self->{total_steps} = $message->getAttribute('total_steps'); } } return $self->{total_steps}; @@ -422,9 +428,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('step_progress'), $lsae->getChildrenByTagName('lsae:step_progress')); + my @message = ($lsae->getChildrenByTagName('step_progress')); my $message = shift(@message); - $self->{steps_completed} = $message->getAttribute('steps_completed') || $message->getAttribute('moby:steps_completed'); + $self->{steps_completed} = $message->getAttribute('steps_completed'); } } return $self->{steps_completed}; @@ -440,9 +446,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('time_progress'), $lsae->getChildrenByTagName('lsae:time_progress')); + my @message = ($lsae->getChildrenByTagName('time_progress')); my $message = shift(@message); - $self->{remaining} = $message->getAttribute('remaining') || $message->getAttribute('moby:remaining'); + $self->{remaining} = $message->getAttribute('remaining'); } } return $self->{remaining}; @@ -464,7 +470,7 @@ my $id = " id=\"".$self->{id}."\"" if defined $self->{id}; my $timestamp = " timestamp=\"".$self->{timestamp}."\"" if defined $self->{timestamp}; - my $header = ""; + my $header = ""; my $footer = ""; my $message = "".$self->{message}."" if defined $self->{message}; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm 2007/04/02 12:13:32 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm 2007/07/18 10:47:24 1.8 @@ -6,8 +6,14 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). =head1 DESCRIPTION @@ -225,7 +231,7 @@ } my $version = $self->{smessageVersion}; $data = " - + $data @@ -240,19 +246,19 @@ die "ERROR: ".$ans->faultstring if ($ans->fault); # Get address from the returned Endpoint Reference - my $address = $ans->match("//Body//{$WSRF::Constants::WSA}Address") ? - $ans->valueof("//Body//{$WSRF::Constants::WSA}Address") : + my $address = $ans->match("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") ? + $ans->valueof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") : die "ERROR: no EndpointReference returned"; die "ERROR: no address into returned EndpointReference" unless ($address); # Get resource identifier from the returned Endpoint Reference my $identifier; - if ($ans->dataof('//Body//ReferenceParameters/*')) { - foreach my $a ($ans->dataof('//Body//ReferenceParameters/*')) { + if ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { + foreach my $a ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { my $name = $a->name(); my $uri = $a->uri(); my $value = $a->value(); - if ($name eq "ServiceInvocationId") { + if ($name eq "ServiceInvocationId" && $uri eq $WSRF::Constants::MOBY) { $identifier = $value; last; } @@ -263,7 +269,7 @@ # Compose the Endpoint Reference my $EPR = WSRF::WS_Address->new(); $EPR->Address($address); - $EPR->ReferenceParameters(''.$identifier.''); + $EPR->ReferenceParameters(''.$identifier.''); print XML::LibXML->new->parse_string($EPR->XML)->getDocumentElement()->toString."\n\n" unless ($self->{silent}); @@ -358,7 +364,7 @@ } my $version = $self->{smessageVersion}; $data = " - + $data @@ -373,19 +379,19 @@ die "ERROR: ".$ans->faultstring if ($ans->fault); # Get address from the returned Endpoint Reference - my $address = $ans->match("//Body//{$WSRF::Constants::WSA}Address") ? - $ans->valueof("//Body//{$WSRF::Constants::WSA}Address") : + my $address = $ans->match("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") ? + $ans->valueof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") : die "ERROR: no EndpointReference returned"; die "ERROR: no address into returned EndpointReference" unless ($address); # Get resource identifier from the returned Endpoint Reference my $identifier; - if ($ans->dataof('//Body//ReferenceParameters/*')) { - foreach my $a ($ans->dataof('//Body//ReferenceParameters/*')) { + if ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { + foreach my $a ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { my $name = $a->name(); my $uri = $a->uri(); my $value = $a->value(); - if ($name eq "ServiceInvocationId") { + if ($name eq "ServiceInvocationId" && $uri eq $WSRF::Constants::MOBY) { $identifier = $value; last; } @@ -396,7 +402,7 @@ # Compose the Endpoint Reference my $EPR = WSRF::WS_Address->new(); $EPR->Address($address); - $EPR->ReferenceParameters(''.$identifier.''); + $EPR->ReferenceParameters(''.$identifier.''); print XML::LibXML->new->parse_string($EPR->XML)->getDocumentElement()->toString."\n\n" unless ($self->{silent}); @@ -502,7 +508,7 @@ sub _getServiceEndpoint { my ($wsdl) = @_; - $wsdl =~ /location\s*=\s*["|'](.+)["|']/; + $wsdl =~ /address location\s*=\s*["|'](.+)["|']/; my $serviceEndpoint = $1; return $serviceEndpoint; @@ -609,19 +615,19 @@ my $moby = $doc->getDocumentElement(); # Get authority - my @mobyContents = ($moby->getChildrenByTagName('mobyContent'), $moby->getChildrenByTagName('moby:mobyContent')); + my @mobyContents = ($moby->getChildrenByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS, 'mobyContent')); my $mobyContent = shift(@mobyContents); - my $authority = $mobyContent->getAttribute('authority') || $mobyContent->getAttribute('moby:authority'); + my $authority = $mobyContent->getAttribute('authority') || $mobyContent->getAttributeNS($WSRF::Constants::MOBY_MESSAGE_NS, 'authority'); push(@authorities, $authority); # Get exceptions - my @mobyException = ($moby->getElementsByTagName('mobyException'), $moby->getElementsByTagName('moby:mobyException')); + my @mobyException = ($moby->getElementsByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS, 'mobyException')); foreach my $mobyException (@mobyException) { push(@exceptions, $mobyException->toString()); } # Get queries - my @mobyData = ($moby->getElementsByTagName('mobyData'), $moby->getElementsByTagName('moby:mobyData')); + my @mobyData = ($moby->getElementsByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS, 'mobyData')); foreach my $mobyData (@mobyData) { push(@queries, $mobyData->toString()); } @@ -629,7 +635,7 @@ my $moby; $moby = responseHeader(shift(@authorities)); - $moby .= "".join("", @exceptions)."" if (scalar(@exceptions)); + $moby .= "".join("", @exceptions)."" if (scalar(@exceptions)); $moby .= join("", @queries) if (scalar(@queries)); $moby .= responseFooter(); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm 2007/04/02 12:13:32 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm 2007/07/18 10:47:24 1.4 @@ -6,8 +6,15 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). + =head1 DESCRIPTION @@ -108,14 +115,18 @@ # Create an EndpointReference for the resource my $EPR = WSRF::WS_Address->new(); $EPR->Address("http://".$ENV{SERVER_NAME}.$ENV{SCRIPT_NAME}); - $EPR->ReferenceParameters(''.$ENV{ID}.''); + $EPR->ReferenceParameters(''.$ENV{ID}.''); $EPR = XML::LibXML->new->parse_string($EPR->XML)->getDocumentElement->toString; # Write the properties to a file WSRF::File::toFile($ID); # Return the EndpointReference - return WSRF::Header::header($envelope), SOAP::Data->value($EPR)->type('xml'); + return WSRF::Header::header($envelope), SOAP::Data->uri($WSRF::Constants::MOBY) + ->name('body' => \SOAP::Data->value( + SOAP::Data->type('xml'=>$EPR) + ) + ); }; #=============================================================================== @@ -142,14 +153,14 @@ my $moby = $doc->getDocumentElement(); # Get authority - my @mobyContents = ($moby->getChildrenByTagName('mobyContent'), $moby->getChildrenByTagName('moby:mobyContent')); + my @mobyContents = ($moby->getChildrenByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS,'mobyContent')); my $mobyContent = shift(@mobyContents); - my $auth = $mobyContent->getAttribute('authority') || $mobyContent->getAttribute('moby:authority'); + my $auth = $mobyContent->getAttribute('authority') || $mobyContent->getAttributeNS($WSRF::Constants::MOBY_MESSAGE_NS,'authority'); # Get mobyData and iterate over them in order to run the service for each one - my @mobyData = ($moby->getElementsByTagName('mobyData'), $moby->getElementsByTagName('moby:mobyData')); + my @mobyData = ($moby->getElementsByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS,'mobyData')); foreach my $mobyData (@mobyData) { - my $queryID = $mobyData->getAttribute('queryID') || $mobyData->getAttribute('moby:queryID'); + my $queryID = $mobyData->getAttribute('queryID') || $mobyData->getAttributeNS($WSRF::Constants::MOBY_MESSAGE_NS,'queryID'); my $property_pid = "pid_$queryID"; my $property_input = "input_$queryID"; my $property_status = "status_$queryID"; @@ -183,7 +194,7 @@ # Result my $result; $result = responseHeader($ENV{AUTHURI}); - $result .= ""; + $result .= ""; $result .= "701"; $result .= "Unable to submit job."; $result .= ""; @@ -264,9 +275,25 @@ my $result; eval { my $xml = $func->($class, $input); - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_string($xml->value); - $result = $doc->getDocumentElement->toString; + if(UNIVERSAL::isa($xml,'XML::LibXML::Node')) { + if(UNIVERSAL::isa($xml,'XML::LibXML::Document')) { + $result=$xml->getDocumentElement()->toString(); + } else { + $result=$xml->toString(); + } + } else { + my $parser = XML::LibXML->new(); + my $toparse; + if(ref(\$xml) eq 'SCALAR') { + $toparse=$xml; + } elsif(UNIVERSAL::isa($xml,'SOAP::Data')) { + $toparse=$xml->value(); + } else { + die "FATAL ERROR: Unable to handle result type ".ref($xml); + } + my $doc = $parser->parse_string($toparse); + $result = $doc->getDocumentElement()->toString(); + } }; # Check if there has been errors during service execution @@ -294,7 +321,7 @@ # Result $result = responseHeader($ENV{AUTHURI}); - $result .= ""; + $result .= ""; $result .= "701"; $result .= "Error while executing job."; $result .= ""; @@ -304,7 +331,7 @@ } # New properties values - my $lock = WSRF::MobyFile->new($envelope); + $lock = WSRF::MobyFile->new($envelope); $WSRF::WSRP::Private{$property_pid} = ''; $WSRF::WSRP::ResourceProperties{$property_status} = $status->XML(); $WSRF::WSRP::ResourceProperties{$property_result} = $result; @@ -317,7 +344,7 @@ } # Compose response using the status properties - my $lock = WSRF::MobyFile->new($envelope); + $lock = WSRF::MobyFile->new($envelope); my $ans = ''; foreach my $queryID (@queryIDs) { my $property_status = "status_$queryID"; @@ -333,7 +360,11 @@ $lock->toFile(); # Return status properties - return WSRF::Header::header($envelope), SOAP::Data->value($ans)->type('xml'); +# return WSRF::Header::header($envelope), SOAP::Data->uri($WSRF::Constants::MOBY) +# ->name('body' => \SOAP::Data->value( +# SOAP::Data->type('xml'=>$ans) +# )); + return WSRF::Header::header($envelope), SOAP::Data->type('xml'=>$ans); }; #=============================================================================== @@ -372,7 +403,7 @@ } $ans .= responseHeader($ENV{AUTHURI}); - $ans .= "$exception"; + $ans .= "$exception"; $ans .= $response; $ans .= responseFooter(); $ans = SOAP::Data->value($ans)->type('string'); @@ -407,7 +438,7 @@ my $ans; $ans .= responseHeader($ENV{AUTHURI}); - $ans .= "$exception"; + $ans .= "$exception"; $ans .= $response; $ans .= responseFooter(); @@ -421,6 +452,11 @@ # sub async { my $wsa = $async_create->(@_); + # The specification says that async always work + # so any error related to job creation must + # be got using poll. + # That's the reason why we are ignoring the returned + # value from $async_submit $async_submit->(@_); return $wsa; } @@ -433,7 +469,7 @@ sub Destroy { my ($class, $envelope) = ($_[0], $_[$#_]); - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); $lock->toFile(); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/WSRF.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/Async/WSRF.pm 2007/04/02 12:13:32 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/WSRF.pm 2007/07/18 10:47:24 1.3 @@ -6,8 +6,14 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). =head1 DESCRIPTION @@ -29,12 +35,13 @@ $WSRF::Constants::Data = '/tmp/moby_'; $WSRF::Constants::MOBY = 'http://biomoby.org/'; +$WSRF::Constants::MOBY_MESSAGE_NS = 'http://www.biomoby.org/moby'; $WSRF::Constants::WSA = 'http://www.w3.org/2005/08/addressing'; $WSRF::Constants::WSRP = 'http://docs.oasis-open.org/wsrf/rp-2'; $WSRF::Constants::WSRL = 'http://docs.oasis-open.org/wsrf/rl-2'; $WSRF::Constants::WSSG = 'http://docs.oasis-open.org/wsrf/sg-2'; $WSRF::Constants::WSBF = 'http://docs.oasis-open.org/wsrf/bf-2'; -$WSRF::Constants::WSA_ANON = 'http://www.w3.org/2005/03/addressing/role/anonymous'; +$WSRF::Constants::WSA_ANON = 'http://www.w3.org/2005/08/addressing/anonymous'; #=============================================================================== # WSRF::Serializer @@ -200,11 +207,11 @@ my $self = shift @_; my $envelope = pop @_; - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); $lock->toFile(); - my $search = $envelope->valueof('//GetResourceProperty/'); + my $search = $envelope->valueof("//{$WSRF::Constants::WSRP}GetResourceProperty/"); WSRF::BaseFaults::die_with_fault( $envelope, ( BaseFault => "InvalidResourcePropertyQNameFault", Description => "Property $search does not exist" @@ -220,12 +227,12 @@ my $self = shift @_; my $envelope = pop @_; - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); $lock->toFile(); my @notfound; - foreach my $search ($envelope->valueof('//ResourceProperty/')) { + foreach my $search ($envelope->valueof("//{$WSRF::Constants::WSRP}ResourceProperty/")) { push(@notfound, $search) unless (defined($WSRF::WSRP::ResourceProperties{$search})); } WSRF::BaseFaults::die_with_fault( $envelope, ( @@ -253,7 +260,7 @@ use vars qw(@ISA); @ISA = qw(WSRF::FileBasedMobyResourceProperties); -# Add reource property TerminationTime - initalise to nothing (infinity). +# Add resource property TerminationTime - initalise to nothing (infinity). $WSRF::WSRP::ResourceProperties{'TerminationTime'} = ''; $WSRF::WSRP::PropertyNamespaceMap->{TerminationTime}{prefix} = "wsrl"; $WSRF::WSRP::Nillable{TerminationTime} = 1; @@ -273,7 +280,7 @@ sub Destroy { my $self = shift @_; my $envelope = pop @_; - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); my $file = $WSRF::Constants::Data.$lock->ID(); unlink $file or WSRF::BaseFaults::die_with_fault( $envelope, ( @@ -390,8 +397,8 @@ if (defined($args{From})) { $myHeader .= "".$args{From}.""; } else { - if ( $envelope->match("/Envelope/Header/{$WSRF::Constants::WSA}To") ) { - my $from = $envelope->valueof("/Envelope/Header/{$WSRF::Constants::WSA}To"); + if ( $envelope->match("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::WSA}To") ) { + my $from = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::WSA}To"); $myHeader .= "$from"; } } @@ -407,7 +414,7 @@ if (defined($args{Action})) { $myHeader .= "".$args{Action}.""; } else { - my $data = $envelope->match('/Envelope/Body/[1]')->dataof; + my $data = $envelope->match("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Body/[1]")->dataof; my $method = $data->name; my $uri = $data->uri; $myHeader .= "".$uri."/".$method."Response"; @@ -488,7 +495,7 @@ } foreach my $propertyPrefix (@{$WSRF::WSRP::MobyPropertiesPrefixes}) { $WSRF::WSRP::ResourceProperties{$propertyPrefix.'_'.$queryID} = $WSRF::WSRP::ResourceProperties{$propertyPrefix.'_'.$queryID} || ''; - $WSRF::WSRP::PropertyNamespaceMap->{$propertyPrefix.'_'.$queryID}{prefix} = 'moby'; + $WSRF::WSRP::PropertyNamespaceMap->{$propertyPrefix.'_'.$queryID}{prefix} = 'mobyws'; $WSRF::WSRP::PropertyNamespaceMap->{$propertyPrefix.'_'.$queryID}{namespace} = $WSRF::Constants::MOBY; $WSRF::WSRP::NotDeletable{$propertyPrefix.'_'.$queryID} = 1; $WSRF::WSRP::NotModifiable{$propertyPrefix.'_'.$queryID} = 1; From gordonp at dev.open-bio.org Tue Jul 3 14:32:39 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 3 Jul 2007 10:32:39 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707031432.l63EWdQK022021@dev.open-bio.org> gordonp Tue Jul 3 10:32:39 EDT 2007 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv21986/docs Modified Files: DataPackageInAnger.html Log Message: Updated Seahawk JAR link moby-live/Java/docs DataPackageInAnger.html,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2007/01/19 18:32:36 1.3 +++ /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2007/07/03 14:32:39 1.4 @@ -43,7 +43,7 @@

    The code library

    You could get the whole jMOBY CVS source, including its library dependencies, or you can - simply use the JAR file (~2.7MB) + simply use the JAR file (~4MB) for the Seahawk client. It is self-contained, and sufficient to do any processing you will require to call MOBY services and MOBY Central. From kawas at dev.open-bio.org Thu Jul 5 17:31:46 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:31:46 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051731.l65HVkoi028848@dev.open-bio.org> kawas Thu Jul 5 13:31:45 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates In directory dev.open-bio.org:/tmp/cvs-serv28813/RDF/Predicates Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates added to the repository moby-live/Perl/MOBY/RDF/Predicates - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/RCS/directory,v: No such file or directory From kawas at dev.open-bio.org Thu Jul 5 17:31:48 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:31:48 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051731.l65HVm5d028902@dev.open-bio.org> kawas Thu Jul 5 13:31:48 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates In directory dev.open-bio.org:/tmp/cvs-serv28871/RDF/Predicates Added Files: OMG_LSID.pm RDFS.pm MOBY_PREDICATES.pm RDF.pm OWL.pm DC_PROTEGE.pm FETA.pm Log Message: initial commit of rdf vocab that is used... moby-live/Perl/MOBY/RDF/Predicates OMG_LSID.pm,NONE,1.1 RDFS.pm,NONE,1.1 MOBY_PREDICATES.pm,NONE,1.1 RDF.pm,NONE,1.1 OWL.pm,NONE,1.1 DC_PROTEGE.pm,NONE,1.1 FETA.pm,NONE,1.1 From kawas at dev.open-bio.org Thu Jul 5 17:38:22 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:38:22 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051738.l65HcMAa028946@dev.open-bio.org> kawas Thu Jul 5 13:38:22 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv28912/RDF/Ontologies Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies added to the repository moby-live/Perl/MOBY/RDF/Ontologies - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/RCS/directory,v: No such file or directory From kawas at dev.open-bio.org Thu Jul 5 17:38:26 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:38:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051738.l65HcQQg029000@dev.open-bio.org> kawas Thu Jul 5 13:38:26 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv28969/RDF/Ontologies Added Files: Objects.pm Namespaces.pm Services.pm ServiceTypes.pm Log Message: initlal commit of RDF generating code. TODO: URIs still have to be retrieved from mobycentral.config file LibXML::XSLT and RDF::Core are required libraries isAlive for service instances not added yet This is still a work in progress! moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,NONE,1.1 Namespaces.pm,NONE,1.1 Services.pm,NONE,1.1 ServiceTypes.pm,NONE,1.1 From kawas at dev.open-bio.org Thu Jul 5 17:39:02 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 5 Jul 2007 13:39:02 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707051739.l65Hd2lg029054@dev.open-bio.org> kawas Thu Jul 5 13:39:02 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv29023/RDF Added Files: Utils.pm Log Message: a module that should be updated to include sub routines that RDF generating code will find useful moby-live/Perl/MOBY/RDF Utils.pm,NONE,1.1 From kawas at dev.open-bio.org Fri Jul 6 15:02:19 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 6 Jul 2007 11:02:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707061502.l66F2Jgf002533@dev.open-bio.org> kawas Fri Jul 6 11:02:18 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv2495/RDF Modified Files: Utils.pm Log Message: removed dependency on LibXSLT for the time being moby-live/Perl/MOBY/RDF Utils.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/07/05 17:39:02 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/07/06 15:02:18 1.2 @@ -9,7 +9,7 @@ package MOBY::RDF::Utils; use XML::LibXML; -use XML::LibXSLT; +#use XML::LibXSLT; use strict; @@ -97,13 +97,14 @@ END } my $parser = XML::LibXML->new(); - my $xslt = XML::LibXSLT->new(); +# my $xslt = XML::LibXSLT->new(); my $source = $parser->parse_string($xml); - my $style_doc = $parser->parse_string( $self->{xslt} ); - my $stylesheet = $xslt->parse_stylesheet($style_doc); - my $results = $stylesheet->transform($source); - $xml = $stylesheet->output_string($results); - return '' . $xml; +# my $style_doc = $parser->parse_string( $self->{xslt} ); +# my $stylesheet = $xslt->parse_stylesheet($style_doc); +# my $results = $stylesheet->transform($source); +# $xml = $stylesheet->output_string($results); + $xml = $source->toString(0); + return $xml; } 1; From gordonp at dev.open-bio.org Fri Jul 6 22:06:51 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 6 Jul 2007 18:06:51 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707062206.l66M6peX019854@dev.open-bio.org> gordonp Fri Jul 6 18:06:51 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv19819/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java Log Message: Made doc on meaning of the class to MOBY clearer moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/06/09 18:12:52 1.16 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/07/06 22:06:51 1.17 @@ -14,6 +14,12 @@ import org.biomoby.shared.parser.MobyTags; /** + * This is the class that represents any non-primitive object instance + * (i.e. anything except object, boolean, integer, float, date-time, or string) + * from the MOBY data type ontology. The members of the composite + * object are stored in a Java Map, and can be either primitives, or + * other composites. + * * This class implements the ConcurrentMap interface to allow for the easy * editing of a composite object's members at runtime. */ From gordonp at dev.open-bio.org Fri Jul 6 22:11:02 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 6 Jul 2007 18:11:02 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707062211.l66MB2p5019919@dev.open-bio.org> gordonp Fri Jul 6 18:11:01 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv19884/src/main/org/biomoby/shared/data Modified Files: MobyDataObject.java Log Message: Javadoc: Clarified role of this class in representing MOBY data instances (i.e. limited) moby-live/Java/src/main/org/biomoby/shared/data MobyDataObject.java,1.17,1.18 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/06/19 18:05:35 1.17 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/07/06 22:11:01 1.18 @@ -21,8 +21,12 @@ import org.biomoby.shared.parser.MobyTags; /** - * A class representing a MOBY object that has been instantiated. - * It provides methods to instantiate the object value either simply using an ID (in which case an + * A class representing a base MOBY object (i.e. just a namespace and id) that has been instantiated. + * If you are looking to represent an object with members (e.g. DNASequence), look at MobyDataComposite. + * If you are looking to represent a MOBY primitive object, please see the appropriate + * subclass of this class (e.g. MobyDataInteger). + * + * This class provides methods to instantiate the object value either simply using an ID (in which case an * Object tag is created automatically), or via XML input either from a DOM Element * (preferred) or a string containing the XML. The toXML method will return either service call * or search template formatted XML depending on the mode set. From kawas at dev.open-bio.org Mon Jul 9 19:54:31 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 9 Jul 2007 15:54:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707091954.l69JsV4a031288@dev.open-bio.org> kawas Mon Jul 9 15:54:31 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31253/RDF/Ontologies Modified Files: Objects.pm Log Message: removed bnodes from RDF. structure a little different than before... BETA moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 19:54:31 1.2 @@ -73,6 +73,7 @@ # create an object my $self = bless {}, ref($class) || $class; $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; + $self->{uri_comp} = 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; $self->{query_all} = < $storage ); my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; - + # add root of ontology - { - my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); -# $model->addStmt( -# new RDF::Core::Statement( -# $resource, -# $resource->new( MOBY::RDF::Predicates::RDF->type ), -# new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) -# ) -# ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal("Object") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal( -"a base object class consisting of a namespace and an identifier" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal("openinformatics.com") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), - new RDF::Core::Literal( -"urn:lsid:biomoby.org:objectclass:Object:2001-09-21T16-00-00Z" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal("jason\@openinformatics.com") - ) - ); - } + $self->_addOntologyRoot($model); my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -181,15 +134,177 @@ my $lsid = $$ref[5]; my $authority = $$ref[6]; my $email = $$ref[7]; - + my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + + } + $sth->finish(); + $db->disconnect(); + + my $xml = ''; + my $serializer = new RDF::Core::Model::Serializer( + Model => $model, + Output => \$xml, + BaseURI => 'URI://BASE/', + ); + $serializer->serialize; + return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) + unless $prettyPrint eq 'no'; + return $xml; +} + +=head2 createByName + +Return a string of RDF in XML that represents a specific datatype in the + Objects ontology. This sub routine takes one argument, 'term', + that represents the ontology term that you would like to create RDF + for. For example, the term 'DNASequence' would return RDF describing + DNASequence and all of its parents and container relationships. + + This routine consumes a hash as input with keys: + term: the node to retrieve B + prettyPrint: whether (yes) or not (no) to output 'pretty print' formatted XML. Defaults to 'yes'. + +=cut + +sub createByName { + my ( $self, $hash ) = @_; + die "No term specified!" unless $hash->{term}; + + # set up the term that we care about + my $term = $hash->{term}; + my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; + + my $termExists = 0; + + # set up an RDF model + my $storage = new RDF::Core::Storage::Memory; + my $model = new RDF::Core::Model( Storage => $storage ); + + # add root of ontology + $self->_addOntologyRoot($model); + my $node_factory = new RDF::Core::NodeFactory(); + + do { + my $CONF = MOBY::Config->new; + my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); + my $db = $adap->dbh; + my $sth = $db->prepare( $self->{query} ); + $sth->execute( ($term) ); + +# this line is here, because there are some datatypes in the ontology not rooted at 'Object' and while illegal, this would kill this code. + $term = ''; + + #base case + $term = '' if $term eq 'Object'; + + # returns an array of hash references + while ( my $ref = $sth->fetchrow_arrayref ) { + $termExists++; + my $subject = $$ref[0]; + my $relationship = $$ref[1]; + my $object = $$ref[2]; + my $articlename = $$ref[3] || ''; + my $description = $$ref[4]; + my $lsid = $$ref[5]; + my $authority = $$ref[6]; + my $email = $$ref[7]; + my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); + $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + do { + $term = $object; + } if $relationship =~ m/.*\:isa$/; + + } + $sth->finish(); + $db->disconnect(); + + } while ( $term && $term ne '' ); + my $xml = ''; + my $serializer = new RDF::Core::Model::Serializer( + Model => $model, + Output => \$xml, + BaseURI => 'URI://BASE/', + ); + $serializer->serialize; + + # dont output anything unless term exists! + unless ( $termExists > 0 ) { + $xml = < +END + } + return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) + unless $prettyPrint eq 'no'; + return $xml; +} + +sub _addOntologyRoot { + my ( $self, $model ) = @_; + my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); + + # $model->addStmt( + # new RDF::Core::Statement( + # $resource, + # $resource->new( MOBY::RDF::Predicates::RDF->type ), + # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + # ) + # ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->label ), + new RDF::Core::Literal("Object") + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->comment ), + new RDF::Core::Literal( +"a base object class consisting of a namespace and an identifier" ) - ); + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), + new RDF::Core::Literal("openinformatics.com") + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), + new RDF::Core::Literal( + "urn:lsid:biomoby.org:objectclass:Object:2001-09-21T16-00-00Z" + ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), + new RDF::Core::Literal("jason\@openinformatics.com") + ) + ); + +} + +sub _foo { + +my ($self,$model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email) = @_; + + + # $model->addStmt( + # new RDF::Core::Statement( + # $resource, + # $resource->new( MOBY::RDF::Predicates::RDF->type ), + # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + # ) + # ); $model->addStmt( new RDF::Core::Statement( $resource, @@ -240,159 +355,73 @@ # add hasa container relationships do { - my $bnode = new RDF::Core::NodeFactory()->newResource; - my $container = new RDF::Core::Resource( $self->{uri}, $object ); + my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); + $model->addStmt( + new RDF::Core::Statement( + $container, $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) + ) + ); $model->addStmt( new RDF::Core::Statement( $resource, $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->hasa ), - $bnode + $container ) ); $model->addStmt( new RDF::Core::Statement( - $bnode, - $bnode->new( + $container, + $container->new( MOBY::RDF::Predicates::MOBY_PREDICATES->articleName ), - new RDF::Core::Literal($object) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container + new RDF::Core::Literal($articlename) ) ); + $self->_processISAs($model, $object); + } if $relationship =~ m/.*\:hasa$/; # add has container relationship do { - my $bnode = new RDF::Core::NodeFactory()->newResource; - my $container = new RDF::Core::Resource( $self->{uri}, $object ); + my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); + $model->addStmt( + new RDF::Core::Statement( + $container, $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) + ) + ); + $model->addStmt( new RDF::Core::Statement( $resource, $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->has ), - $bnode + $container ) ); $model->addStmt( new RDF::Core::Statement( - $bnode, - $bnode->new( + $container, + $container->new( MOBY::RDF::Predicates::MOBY_PREDICATES->articleName ), - new RDF::Core::Literal($object) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container + new RDF::Core::Literal($articlename) ) ); + $self->_processISAs($model, $object); + } if $relationship =~ m/.*\:has$/; - } - $sth->finish(); - $db->disconnect(); - - my $xml = ''; - my $serializer = new RDF::Core::Model::Serializer( - Model => $model, - Output => \$xml, - BaseURI => 'URI://BASE/', - ); - $serializer->serialize; - return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) unless $prettyPrint eq 'no'; - return $xml; } -=head2 createByName - -Return a string of RDF in XML that represents a specific datatype in the - Objects ontology. This sub routine takes one argument, 'term', - that represents the ontology term that you would like to create RDF - for. For example, the term 'DNASequence' would return RDF describing - DNASequence and all of its parents and container relationships. - - This routine consumes a hash as input with keys: - term: the node to retrieve B - prettyPrint: whether (yes) or not (no) to output 'pretty print' formatted XML. Defaults to 'yes'. - -=cut +sub _processISAs { + my ( $self, $model, $term ) = @_; -sub createByName { - my ( $self, $hash ) = @_; - die "No term specified!" unless $hash->{term}; - - # set up the term that we care about - my $term = $hash->{term}; - my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; - my $termExists = 0; - - # set up an RDF model - my $storage = new RDF::Core::Storage::Memory; - my $model = new RDF::Core::Model( Storage => $storage ); - - # add root of ontology - { - my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); -# $model->addStmt( -# new RDF::Core::Statement( -# $resource, -# $resource->new( MOBY::RDF::Predicates::RDF->type ), -# new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) -# ) -# ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal("Object") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal( -"a base object class consisting of a namespace and an identifier" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal("openinformatics.com") - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), - new RDF::Core::Literal( -"urn:lsid:biomoby.org:objectclass:Object:2001-09-21T16-00-00Z" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal("jason\@openinformatics.com") - ) - ); - } - my $node_factory = new RDF::Core::NodeFactory(); - - # add the datatype Object to the model + do { my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -417,155 +446,19 @@ my $lsid = $$ref[5]; my $authority = $$ref[6]; my $email = $$ref[7]; - my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); -# $model->addStmt( -# new RDF::Core::Statement( -# $resource, -# $resource->new( MOBY::RDF::Predicates::RDF->type ), -# new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) -# ) -# ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal($subject) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal($description) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::DC_PROTEGE->publisher - ), - new RDF::Core::Literal($authority) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::DC_PROTEGE->identifier - ), - new RDF::Core::Literal($lsid) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::DC_PROTEGE->creator - ), - new RDF::Core::Literal($email) - ) - ); - - # add subclassof, if applicable + $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); do { - my $parent = new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::RDFS->subClassOf - ), - $parent - ) - ); $term = $object; } if $relationship =~ m/.*\:isa$/; - # add hasa container relationships - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->hasa - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:hasa$/; - - # add has container relationship - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->has - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:has$/; - } $sth->finish(); $db->disconnect(); } while ( $term && $term ne '' ); - my $xml = ''; - my $serializer = new RDF::Core::Model::Serializer( - Model => $model, - Output => \$xml, - BaseURI => 'URI://BASE/', - ); - $serializer->serialize; - # dont output anything unless term exists! - unless ( $termExists > 0 ) { - $xml = < -END - } - return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) unless $prettyPrint eq 'no'; - return $xml; } + 1; __END__ From kawas at dev.open-bio.org Mon Jul 9 20:53:46 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 9 Jul 2007 16:53:46 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707092053.l69KrkRr031405@dev.open-bio.org> kawas Mon Jul 9 16:53:46 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31370/RDF/Ontologies Modified Files: Objects.pm Log Message: renamed a few routines and applied url + base64 to articlenames in the URI portion of HAS/HASA members. moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 19:54:31 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 20:53:46 1.3 @@ -27,6 +27,8 @@ use MOBY::RDF::Utils; +use MIME::Base64; +use CGI; use strict; #----------------------------------------------------------------- @@ -72,8 +74,9 @@ # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; - $self->{uri_comp} = 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; + $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; + $self->{uri_comp} = + 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; $self->{query_all} = <{uri}, $subject ); - $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + $self->_processDatatype( + $model, $resource, $subject, $relationship, + $object, $articlename, $description, $lsid, + $authority, $email + ); } $sth->finish(); @@ -185,7 +192,7 @@ # add root of ontology $self->_addOntologyRoot($model); my $node_factory = new RDF::Core::NodeFactory(); - + do { my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -211,7 +218,11 @@ my $authority = $$ref[6]; my $email = $$ref[7]; my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); - $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + $self->_processDatatype( + $model, $resource, $subject, $relationship, + $object, $articlename, $description, $lsid, + $authority, $email + ); do { $term = $object; } if $relationship =~ m/.*\:isa$/; @@ -240,6 +251,9 @@ return $xml; } + +#####-----------------------Private Routines--------------------------##### + sub _addOntologyRoot { my ( $self, $model ) = @_; my $resource = new RDF::Core::Resource( $self->{uri}, "Object" ); @@ -293,135 +307,141 @@ } -sub _foo { +sub _processDatatype { + + my ( + $self, $model, $resource, $subject, + $relationship, $object, $articlename, $description, + $lsid, $authority, $email + ) + = @_; -my ($self,$model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email) = @_; - + # $model->addStmt( + # new RDF::Core::Statement( + # $resource, + # $resource->new( MOBY::RDF::Predicates::RDF->type ), + # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) + # ) + # ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->label ), + new RDF::Core::Literal($subject) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDFS->comment ), + new RDF::Core::Literal($description) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), + new RDF::Core::Literal($authority) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), + new RDF::Core::Literal($lsid) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), + new RDF::Core::Literal($email) + ) + ); - # $model->addStmt( - # new RDF::Core::Statement( - # $resource, - # $resource->new( MOBY::RDF::Predicates::RDF->type ), - # new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - # ) - # ); + # add subclassof, if applicable + do { + my $parent = new RDF::Core::Resource( $self->{uri}, $object ); $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->label ), - new RDF::Core::Literal($subject) + $resource->new( MOBY::RDF::Predicates::RDFS->subClassOf ), + $parent ) ); + } if $relationship =~ m/.*\:isa$/; + + # add hasa container relationships + do { + my $container = + new RDF::Core::Resource( $self->{uri_comp}, + $subject . "_" . CGI::escape(encode_base64("$articlename")) ); $model->addStmt( new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->comment ), - new RDF::Core::Literal($description) + $container, + $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) ) ); $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal($authority) + $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->hasa ), + $container ) ); $model->addStmt( new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->identifier ), - new RDF::Core::Literal($lsid) + $container, + $container->new( + MOBY::RDF::Predicates::MOBY_PREDICATES->articleName + ), + new RDF::Core::Literal($articlename) ) ); + $self->_processISAs( $model, $object ); + + } if $relationship =~ m/.*\:hasa$/; + + # add has container relationship + do { + my $container = + new RDF::Core::Resource( $self->{uri_comp}, + $subject . "_" . CGI::escape (encode_base64("$articlename"))); $model->addStmt( new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal($email) + $container, + $container->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( $self->{uri}, $object ) ) ); - # add subclassof, if applicable - do { - my $parent = new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDFS->subClassOf ), - $parent - ) - ); - } if $relationship =~ m/.*\:isa$/; + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::MOBY_PREDICATES->has ), + $container + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $container, + $container->new( + MOBY::RDF::Predicates::MOBY_PREDICATES->articleName + ), + new RDF::Core::Literal($articlename) + ) + ); + $self->_processISAs( $model, $object ); - # add hasa container relationships - do { - my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); - $model->addStmt( - new RDF::Core::Statement( - $container, $container->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( $self->{uri}, $object ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->hasa - ), - $container - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $container, - $container->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $self->_processISAs($model, $object); - - } if $relationship =~ m/.*\:hasa$/; - - # add has container relationship - do { - my $container = new RDF::Core::Resource( $self->{uri_comp}, $subject . "_" . $articlename ); - $model->addStmt( - new RDF::Core::Statement( - $container, $container->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( $self->{uri}, $object ) - ) - ); - - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->has - ), - $container - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $container, - $container->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $self->_processISAs($model, $object); - - } if $relationship =~ m/.*\:has$/; + } if $relationship =~ m/.*\:has$/; } sub _processISAs { my ( $self, $model, $term ) = @_; my $termExists = 0; - + do { my $CONF = MOBY::Config->new; my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); @@ -447,7 +467,11 @@ my $authority = $$ref[6]; my $email = $$ref[7]; my $resource = new RDF::Core::Resource( $self->{uri}, $subject ); - $self->_foo($model, $resource, $subject, $relationship, $object, $articlename, $description, $lsid, $authority, $email); + $self->_processDatatype( + $model, $resource, $subject, $relationship, + $object, $articlename, $description, $lsid, + $authority, $email + ); do { $term = $object; } if $relationship =~ m/.*\:isa$/; @@ -459,6 +483,5 @@ } while ( $term && $term ne '' ); } - 1; __END__ From gordonp at dev.open-bio.org Wed Jul 11 15:06:57 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 11 Jul 2007 11:06:57 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707111506.l6BF6vKh005460@dev.open-bio.org> gordonp Wed Jul 11 11:06:57 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv5425/src/main/ca/ucalgary/seahawk/gui Modified Files: SeahawkOptionsGUI.java Log Message: Improvements to UI layout implemented by dmitry.repchevski at bsc.es moby-live/Java/src/main/ca/ucalgary/seahawk/gui SeahawkOptionsGUI.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java 2007/06/16 00:32:56 1.4 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java 2007/07/11 15:06:57 1.5 @@ -48,135 +48,151 @@ * @param owner the frame that launches this dialog */ public SeahawkOptionsGUI(Frame owner){ - super(owner, DIALOG_TITLE, DIALOG_MODAL); + super(owner, DIALOG_TITLE, DIALOG_MODAL); - // Custom handling of window close operation - setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - addWindowListener(this); - - // The dreaded GridBagLayout... - GridBagLayout gridbag = new GridBagLayout(); - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - setLayout(gridbag); + // Custom handling of window close operation + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addWindowListener(this); + + // The dreaded GridBagLayout... + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.BOTH; + setLayout(gridbag); - registriesList = new RegistriesList(); - Registry[] registries = registriesList.getAll(); - registryNames = new String[registries.length+1]; - int i = 0; - for(; i < registries.length; i++){ - registryNames[i] = registries[i].getSynonym(); - } - registryNames[i] = CUSTOM_REGISTRY_SYNONYM; - - JLabel label = new JLabel("Registry server:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryComboBox = new JComboBox(registryNames); - registryComboBox.addActionListener(this); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 1.0; - gridbag.setConstraints(registryComboBox, c); - add(registryComboBox); - - label = new JLabel("Description:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryDescTextArea = new JTextPane(); - registryDescTextArea.setEditable(false); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 0.0; // 0 so long lines wrap in text area - c.weighty = 1.0; // absorb all extra vertical space in the desc - gridbag.setConstraints(registryDescTextArea, c); - add(registryDescTextArea); - c.weighty = 0.0; //reset - - label = new JLabel("Location:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryEndpoint = new JTextField(50); - registryEndpoint.setEditable(false); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 1.0; - gridbag.setConstraints(registryEndpoint, c); - add(registryEndpoint); - - label = new JLabel("Namespace:"); - c.gridwidth = 1; - c.weightx = 0.0; - gridbag.setConstraints(label, c); - add(label); - registryNamespace = new JTextField(50); - registryNamespace.setEditable(false); - c.gridwidth = GridBagConstraints.REMAINDER; - c.weightx = 1.0; - gridbag.setConstraints(registryNamespace, c); - add(registryNamespace); - - JSeparator line = new JSeparator(); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(line, c); - add(line); - - sendReferrerCheckBox = new JCheckBox("Send referrer data to services"); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(sendReferrerCheckBox, c); - add(sendReferrerCheckBox); - - line = new JSeparator(); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(line, c); - add(line); - - JPanel expiryPanel = new JPanel(new GridLayout(1,0)); - label = new JLabel("Cache expiry (in hours)"); - expiryPanel.add(label); - cacheExpiryTextField = new JTextField(3); - expiryPanel.add(cacheExpiryTextField); - c.gridwidth = 1; - gridbag.setConstraints(expiryPanel, c); - add(expiryPanel); - deleteCacheButton = new JButton("Delete cached items"); - deleteCacheButton.addActionListener(this); - c.gridwidth = 1; - gridbag.setConstraints(deleteCacheButton, c); - add(deleteCacheButton); - - selectCacheDirButton = new JButton("Change cache directory"); - selectCacheDirButton.addActionListener(this); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(selectCacheDirButton, c); - add(selectCacheDirButton); - cacheDirFileChooser = new JFileChooser(); - cacheDirFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - line = new JSeparator(); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(line, c); - add(line); - - resetButton = new JButton("Restore program defaults"); - resetButton.addActionListener(this); - c.gridwidth = 1; - gridbag.setConstraints(resetButton, c); - add(resetButton); - cancelButton = new JButton("Cancel"); - cancelButton.addActionListener(this); - c.gridwidth = 1; - gridbag.setConstraints(cancelButton, c); - add(cancelButton); - okButton = new JButton("Apply changes"); - okButton.addActionListener(this); - c.gridwidth = GridBagConstraints.REMAINDER; - gridbag.setConstraints(okButton, c); - add(okButton); + registriesList = new RegistriesList(); + Registry[] registries = registriesList.getAll(); + registryNames = new String[registries.length+1]; + int i = 0; + for(; i < registries.length; i++){ + registryNames[i] = registries[i].getSynonym(); + } + registryNames[i] = CUSTOM_REGISTRY_SYNONYM; + + c.insets = new Insets(3,2,3,2); + //........................................ + + c.gridwidth = 2; + c.fill = GridBagConstraints.HORIZONTAL; + JLabel label = new JLabel("Registry server:", JLabel.RIGHT); + add(label, c); + + registryComboBox = new JComboBox(registryNames); + registryComboBox.addActionListener(this); + add(registryComboBox, c); + + c.gridheight = 4; + c.fill = GridBagConstraints.NONE; + JPanel bPanel = new JPanel(new GridLayout(3, 0, 3, 3)); + resetButton = new JButton("Restore program defaults"); + resetButton.addActionListener(this); + + cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(this); + + okButton = new JButton("Apply changes"); + okButton.addActionListener(this); + + bPanel.add(resetButton); + bPanel.add(cancelButton); + bPanel.add(okButton); + + add(bPanel, c); + + //........................................ + c.gridx = 0; + c.gridy = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.BOTH; + label = new JLabel("Description:", JLabel.RIGHT); + label.setVerticalAlignment(JLabel.TOP); + add(label, c); + + c.gridx = 2; + c.weightx = 1.0; + c.weighty = 1.0; + registryDescTextArea = new JTextPane(); + registryDescTextArea.setEditable(false); + add(registryDescTextArea, c); + + //........................................ + c.gridx = 0; + c.gridy = 2; + c.weightx = 0.0; + c.weighty = 0.0; + c.fill = GridBagConstraints.HORIZONTAL; + label = new JLabel("Location:", JLabel.RIGHT); + add(label, c); + + c.gridx = 2; + registryEndpoint = new JTextField(50); + registryEndpoint.setEditable(false); + add(registryEndpoint, c); + + //........................................ + + c.gridx = 0; + c.gridy = 3; + label = new JLabel("Namespace:", JLabel.RIGHT); + add(label, c); + + c.gridx = 2; + registryNamespace = new JTextField(50); + registryNamespace.setEditable(false); + add(registryNamespace, c); + + //........................................ + c.gridx = 0; + c.gridy = 4; + c.gridwidth = 6; + JSeparator line = new JSeparator(); + add(line, c); + + //........................................ + c.gridx = 0; + c.gridy = 5; + c.gridwidth = 4; + c.gridheight = 1; + sendReferrerCheckBox = new JCheckBox("Send referrer data to services"); + add(sendReferrerCheckBox, c); + + //........................................ + c.gridy = 6; + c.gridwidth = 6; + line = new JSeparator(); + add(line, c); + + //........................................ + c.gridy = 7; + c.gridwidth = 2; + label = new JLabel("Cache expiry (in hours)", JLabel.RIGHT); + add(label, c); + + c.gridx = 2; + c.gridwidth = 1; + cacheExpiryTextField = new JTextField(3); + cacheExpiryTextField.setMinimumSize(cacheExpiryTextField.getPreferredSize()); // prevents text collapsing + add(cacheExpiryTextField, c); + + c.gridx = 3; + c.gridwidth = 3; + c.fill = GridBagConstraints.NONE; + JPanel cbPanel = new JPanel(new GridLayout(1,0,4,2)); + + deleteCacheButton = new JButton("Delete cached items"); + deleteCacheButton.addActionListener(this); + + selectCacheDirButton = new JButton("Change cache directory"); + selectCacheDirButton.addActionListener(this); + + cbPanel.add(deleteCacheButton); + cbPanel.add(selectCacheDirButton); + + cacheDirFileChooser = new JFileChooser(); + cacheDirFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + add(cbPanel, c); + setCurrentValues(); pack(); } @@ -372,4 +388,17 @@ public void windowDeiconified(WindowEvent e){} public void windowIconified(WindowEvent e){} public void windowOpened(WindowEvent e){} + + public static void main(String[] args) + { + JFrame frame = new JFrame("test"); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + SeahawkOptionsGUI dialog = new SeahawkOptionsGUI(frame); + + frame.pack(); + frame.setVisible(true); + + dialog.setVisible(true); + } } From kawas at dev.open-bio.org Mon Jul 16 21:28:10 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 16 Jul 2007 17:28:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707162128.l6GLSA3V021999@dev.open-bio.org> kawas Mon Jul 16 17:28:09 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv21963/RDF/Ontologies Modified Files: Namespaces.pm Log Message: when querying for the root namespace (Namespace), empty rdf was returned. now not so much! moby-live/Perl/MOBY/RDF/Ontologies Namespaces.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/16 21:28:09 1.2 @@ -263,7 +263,9 @@ my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; my $termExists = 0; - + #special case where term == Namespace + $termExists = $termExists + 1 if $term eq 'Namespace'; + # set up an RDF model my $storage = new RDF::Core::Storage::Memory; my $model = new RDF::Core::Model( Storage => $storage ); @@ -332,7 +334,6 @@ #base case $term = '' if $term eq 'Namespace'; - # returns an array of hash references while ( my $ref = $sth->fetchrow_arrayref ) { $termExists++; From kawas at dev.open-bio.org Tue Jul 17 17:25:40 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 17 Jul 2007 13:25:40 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707171725.l6HHPeIX025946@dev.open-bio.org> kawas Tue Jul 17 13:25:39 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv25915/lsid/authority Added Files: MobyMetadataResolver.pm Log Message: initial checkin of the getMetadata handlers for the LSID namespaces of namespacetype, servicetype, serviceinstance and objectclass. This code doesnt handle relationshiptype yet. The LSID authority perl script will be in moby-live/Perl/scripts/ and called authority.pl. This code requires the module LS::ID moby-live/Perl/MOBY/lsid/authority MobyMetadataResolver.pm,NONE,1.1 From kawas at dev.open-bio.org Tue Jul 17 18:11:43 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 17 Jul 2007 14:11:43 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707171811.l6HIBhg5026243@dev.open-bio.org> kawas Tue Jul 17 14:11:42 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv26208/Java/src/main/org/biomoby/shared/extended Modified Files: DataTypeParser.java Log Message: added one line that enables compatibility with RDF generated by PERL. moby-live/Java/src/main/org/biomoby/shared/extended DataTypeParser.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2006/04/27 14:47:37 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2007/07/17 18:11:42 1.7 @@ -169,6 +169,7 @@ continue; String uri = resource.getURI(); + if (uri.indexOf("/MOBY_SUB_COMPONENT/") > 0) continue; String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); From kawas at dev.open-bio.org Tue Jul 17 20:34:37 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 17 Jul 2007 16:34:37 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707172034.l6HKYbAr026528@dev.open-bio.org> kawas Tue Jul 17 16:34:36 EDT 2007 Update of /home/repository/moby/moby-live/Perl/scripts In directory dev.open-bio.org:/tmp/cvs-serv26497 Added Files: authority.pl Log Message: lsid authority server code moby-live/Perl/scripts authority.pl,NONE,1.1 From kawas at dev.open-bio.org Wed Jul 18 18:55:07 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 18 Jul 2007 14:55:07 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181855.l6IIt7on029232@dev.open-bio.org> kawas Wed Jul 18 14:55:07 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/support/rdfagent In directory dev.open-bio.org:/tmp/cvs-serv29192/Java/src/support/rdfagent Modified Files: run-RDFagent.bat run-RDFagent Log Message: added more heap space to the scripts that call the agent moby-live/Java/src/support/rdfagent run-RDFagent.bat,1.8,1.9 run-RDFagent,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent.bat,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent.bat 2006/10/17 14:23:15 1.8 +++ /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent.bat 2007/07/18 18:55:07 1.9 @@ -8,8 +8,10 @@ set JAVA_HOME=C:/Java/jdk1.5.0_05 set AGENT_HOME=C:/moby-live/Java/docs/dist/rdfagent +rem this line here to add more heap space +set JAVA_OPTS=-Xmx256m -%JAVA_HOME%\bin\java -DRDFagent.home="%AGENT_HOME%" -jar "%AGENT_HOME%RDFagent.jar" %1 %2 +%JAVA_HOME%\bin\java %JAVA_OPTS% -DRDFagent.home="%AGENT_HOME%" -jar "%AGENT_HOME%RDFagent.jar" %1 %2 if %ERRORLEVEL%==0 GOTO DONE goto ERROR =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent 2006/03/02 16:41:02 1.6 +++ /home/repository/moby/moby-live/Java/src/support/rdfagent/run-RDFagent 2007/07/18 18:55:07 1.7 @@ -12,8 +12,8 @@ # please set the following paths JAVA_HOME=/usr/local/jdk1.5.0_03 RDF_AGENT_HOME=/path/to/home/dir/of/rdfagent - -$JAVA_HOME/bin/java -DRDFagent.home=$RDF_AGENT_HOME -jar $RDF_AGENT_HOME/RDFagent.jar $* +JAVA_OPTS=-Xmx256m +$JAVA_HOME/bin/java $JAVA_OPTS -DRDFagent.home=$RDF_AGENT_HOME -jar $RDF_AGENT_HOME/RDFagent.jar $* # did the agent die unexpectedly? check_errs $? From kawas at dev.open-bio.org Thu Jul 19 18:26:59 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 19 Jul 2007 14:26:59 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707191826.l6JIQxEC031568@dev.open-bio.org> kawas Thu Jul 19 14:26:59 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31521/RDF/Ontologies Modified Files: Objects.pm Namespaces.pm Services.pm ServiceTypes.pm Log Message: removed rdf:type->owl:Class statements. Read URIs for each ontology from mobycentral.confgi moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.3,1.4 Namespaces.pm,1.2,1.3 Services.pm,1.1,1.2 ServiceTypes.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/09 20:53:46 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/19 18:26:59 1.4 @@ -21,7 +21,6 @@ use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -74,9 +73,16 @@ # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; - $self->{uri_comp} = - 'http://biomoby.org/RESOURCES/MOBY_SUB_COMPONENT/Objects#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobyobject}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyobject" )->dbh; + + $self->{uri_comp} = $self->{uri}; + $self->{uri_comp} =~ s/\/MOBY\-S\//\/MOBY_SUB_COMPONENT\//; + $self->{query_all} = <_addOntologyRoot($model); - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -194,9 +198,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -443,9 +445,7 @@ my $termExists = 0; do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyobject" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/16 21:28:09 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/19 18:26:59 1.3 @@ -21,7 +21,6 @@ use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -72,7 +71,13 @@ # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobynamespace" )->dbh; + $self->{query_all} = <addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Namespace") ) @@ -160,9 +158,7 @@ ); } - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobynamespace" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -178,13 +174,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) @@ -276,13 +265,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Namespace") ) @@ -324,9 +306,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobynamespace" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -347,13 +327,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/19 18:26:59 1.2 @@ -22,7 +22,6 @@ use MOBY::RDF::Predicates::FETA; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -85,7 +84,11 @@ #TODO - Extract the URIs for Namespaces/ServiceTypes/Objects/ServiceInstances from the moby config file # create an object my $self = bless {}, ref($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobycentral}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; # done return $self; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/07/05 17:38:26 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/07/19 18:26:59 1.2 @@ -21,7 +21,6 @@ use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::MOBY_PREDICATES; use MOBY::RDF::Predicates::OMG_LSID; -use MOBY::RDF::Predicates::OWL; use MOBY::RDF::Predicates::RDF; use MOBY::RDF::Predicates::RDFS; @@ -73,7 +72,13 @@ # create an object my $self = bless {}, ref ($class) || $class; - $self->{uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Services#'; + + # save some information retrieved from mobycentral.config + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobyservice}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Services#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyservice" )->dbh; + $self->{query_all} = <addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Service") ) @@ -165,9 +163,7 @@ ); } - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyservice" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -186,13 +182,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) @@ -282,13 +271,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal("Service") ) @@ -331,9 +313,7 @@ # add the datatype Object to the model do { - my $CONF = MOBY::Config->new; - my $adap = $CONF->getDataAdaptor( source => "mobyservice" ); - my $db = $adap->dbh; + my $db = $self->{moby_data_handler}; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -358,13 +338,6 @@ $model->addStmt( new RDF::Core::Statement( $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( MOBY::RDF::Predicates::OWL->Class ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, $resource->new( MOBY::RDF::Predicates::RDFS->label ), new RDF::Core::Literal($subject) ) @@ -418,69 +391,6 @@ ); $term = $object; } if $relationship =~ m/.*\:isa$/; - - # add hasa container relationships - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->hasa - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:hasa$/; - - # add has container relationship - do { - my $bnode = $node_factory->newResource; - my $container = - new RDF::Core::Resource( $self->{uri}, $object ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->has - ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $bnode->new( - MOBY::RDF::Predicates::MOBY_PREDICATES->articleName - ), - new RDF::Core::Literal($articlename) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, $bnode->new( MOBY::RDF::Predicates::RDF->type ), - $container - ) - ); - } if $relationship =~ m/.*\:has$/; - } $sth->finish(); $db->disconnect(); From kawas at dev.open-bio.org Thu Jul 19 19:38:11 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 19 Jul 2007 15:38:11 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707191938.l6JJcB3Q031661@dev.open-bio.org> kawas Thu Jul 19 15:38:11 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31626/RDF/Ontologies Modified Files: Services.pm Log Message: removed a duplicated line of code that was causing warnings. moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/19 18:26:59 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/07/19 19:38:11 1.3 @@ -143,8 +143,7 @@ my $storage = new RDF::Core::Storage::Memory; my $model = new RDF::Core::Model( Storage => $storage ); my $node_factory = new RDF::Core::NodeFactory(); - my $node_factory = new RDF::Core::NodeFactory(); - + foreach my $SI (@$services) { my $resource = new RDF::Core::Resource( $self->{uri}, From kawas at dev.open-bio.org Thu Jul 19 19:39:17 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 19 Jul 2007 15:39:17 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707191939.l6JJdHgF031704@dev.open-bio.org> kawas Thu Jul 19 15:39:17 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates In directory dev.open-bio.org:/tmp/cvs-serv31669/RDF/Predicates Modified Files: FETA.pm Log Message: removed a duplicated line of code that was causing warnings. moby-live/Perl/MOBY/RDF/Predicates FETA.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/FETA.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/FETA.pm 2007/07/05 17:31:48 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Predicates/FETA.pm 2007/07/19 19:39:17 1.2 @@ -1,6 +1,7 @@ package MOBY::RDF::Predicates::FETA; use strict; +use warnings; BEGIN { @@ -56,7 +57,6 @@ use constant providedBy => FETA_URI . 'providedBy'; use constant mygInstance => FETA_URI . 'mygInstance'; use constant performsTask => FETA_URI . 'performsTask'; - use constant operationTask => FETA_URI . 'operationTask'; use constant usesMethod => FETA_URI . 'usesMethod'; use constant operationMethod => FETA_URI . 'operationMethod'; use constant isFunctionOf => FETA_URI . 'isFunctionOf'; From gordonp at dev.open-bio.org Mon Jul 23 21:32:28 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 17:32:28 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232132.l6NLWSs9017776@dev.open-bio.org> gordonp Mon Jul 23 17:32:27 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test In directory dev.open-bio.org:/tmp/cvs-serv17740/src/main/org/biomoby/service/test Modified Files: MobyServletTestCase.java Log Message: Changed servlet port moby-live/Java/src/main/org/biomoby/service/test MobyServletTestCase.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2007/04/12 00:54:16 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2007/07/23 21:32:27 1.5 @@ -22,7 +22,7 @@ public class MobyServletTestCase extends TestCase{ private final static String TEST_MOBY_XML = "org/biomoby/service/test/mobyAASeq.xml"; private final static String SERVLET_TEST_WEBXML = "org/biomoby/service/test/web.xml"; - private final static String SERVLET_TEST_URL = "http://moby.ucalgary.ca:8089/MobyServlet"; + private final static String SERVLET_TEST_URL = "http://moby.ucalgary.ca:8080/MobyServlet"; private final static String TEST_MAIN_CLASS_NAME = "org.biomoby.service.test.ConvertAAtoFASTA_AA"; /** From gordonp at dev.open-bio.org Mon Jul 23 21:32:58 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 17:32:58 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232132.l6NLWwWa017820@dev.open-bio.org> gordonp Mon Jul 23 17:32:58 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv17784/src/main/org/biomoby/shared/data Modified Files: MobyDataString.java Log Message: Allow null string in c-tor moby-live/Java/src/main/org/biomoby/shared/data MobyDataString.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/06/07 23:58:15 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/07/23 21:32:58 1.7 @@ -43,7 +43,7 @@ public MobyDataString(String articleName, CharSequence stringValue, Registry registry){ super(articleName); setDataType(MobyDataType.getDataType(MobyTags.MOBYSTRING, registry)); - value = new StringBuffer(stringValue.toString()); + value = stringValue == null ? null : new StringBuffer(stringValue.toString()); } public MobyDataString(CharSequence stringValue){ From gordonp at dev.open-bio.org Mon Jul 23 21:35:26 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 17:35:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232135.l6NLZQfD017888@dev.open-bio.org> gordonp Mon Jul 23 17:35:25 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services In directory dev.open-bio.org:/tmp/cvs-serv17852/src/main/ca/ucalgary/seahawk/services Modified Files: MobyComplexBuilder.java Log Message: Fixed support for base64 rules moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyComplexBuilder.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java 2007/06/28 16:45:44 1.10 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java 2007/07/23 21:35:25 1.11 @@ -3,8 +3,9 @@ import ca.ucalgary.seahawk.util.SeahawkOptions; import org.biomoby.shared.*; -import org.biomoby.shared.data.MobyDataObject; +import org.biomoby.shared.data.MobyDataBytes; import org.biomoby.shared.data.MobyDataComposite; +import org.biomoby.shared.data.MobyDataObject; import org.w3c.dom.Document; @@ -171,6 +172,10 @@ if(mobyDataType.getName().equals("Object")){ mobyObj = new MobyDataObject("", SeahawkOptions.getRegistry()); } + else if(mobyDataType.inheritsFrom(MobyDataBytes.BASE64_DATATYPE)){ + mobyObj = new MobyDataBytes("", (String) null); + mobyObj.setDataType(mobyDataType); + } // else ifs for other primitives in the future maybe? else{ mobyObj = new MobyDataComposite(mobyDataType); @@ -280,7 +285,8 @@ for(String result: results){ - if(PrimitiveTypes.isPrimitive(dataTypeName)){ + if(PrimitiveTypes.isPrimitive(dataTypeName) || + MobyDataType.getDataType(dataTypeName, SeahawkOptions.getRegistry()).inheritsFrom(MobyDataBytes.BASE64_DATATYPE)){ ((MobyDataComposite) mobyObj).put(memberName, MobyDataObject.createInstanceFromString(dataTypeName, result)); } From gordonp at dev.open-bio.org Mon Jul 23 22:01:23 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 18:01:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232201.l6NM1NVj017957@dev.open-bio.org> gordonp Mon Jul 23 18:01:22 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources In directory dev.open-bio.org:/tmp/cvs-serv17921/src/main/ca/ucalgary/services/resources Modified Files: acdRules.xml Log Message: Update to include nested parsing rule example moby-live/Java/src/main/ca/ucalgary/services/resources acdRules.xml,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources/acdRules.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources/acdRules.xml 2007/06/08 14:04:27 1.2 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/resources/acdRules.xml 2007/07/23 22:01:22 1.3 @@ -78,45 +78,45 @@ string-length('$2') - + (?:\A|\n)\s*(\S+(\x20{2,}|\t+|))+(?=\n|\z) - - $1 - --> + + $1 + + - + (\p{rowWithWhitespaceSeparatedColumns})+ - - $1 - --> + + $1 + - - (CHARGE \s of \s .*?)\n # Description of input (used as caption) + (CHARGE \s of \s .*?)\n # Description of input used as caption \n # Blank line (Position \s+ Charge\n) # Column headers - ((?: \d+ \s+ -?\d+\.\d+ \n)+ ) # One or more lines of (integer) (spaces) (+/-decimal number) - # Ignore any trailing garbage (no \z given to anchor the end of the input being tested) + ((?: \d+ \s+ -?\d+\.\d+ \n)+ ) # One or more lines of integer spaces +/-decimal-number + # Ignore any trailing data, no \z given to anchor end of input being tested - + $1 - + $2 - + (any number of non-whitespace columns separated by spaces). --> $3 - --> + @@ -133,4 +133,4 @@ $0 - \ No newline at end of file + From gordonp at dev.open-bio.org Mon Jul 23 22:12:30 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 23 Jul 2007 18:12:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707232212.l6NMCUqR018024@dev.open-bio.org> gordonp Mon Jul 23 18:12:30 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test In directory dev.open-bio.org:/tmp/cvs-serv17988/src/main/ca/ucalgary/seahawk/services/test Modified Files: MobyClientTestCase.java Log Message: Made less verbose moby-live/Java/src/main/ca/ucalgary/seahawk/services/test MobyClientTestCase.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test/MobyClientTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test/MobyClientTestCase.java 2007/06/28 16:47:23 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/test/MobyClientTestCase.java 2007/07/23 22:12:30 1.2 @@ -212,7 +212,7 @@ results[0].getDataType().inheritsFrom(targetType)); results[0].setXmlMode(MobyDataInstance.SERVICE_XML_MODE); try{ - MobyDataUtils.toXMLDocument(System.err, new MobyContentInstance(results[0], "param1")); + MobyDataUtils.toXMLDocument(new StringWriter(), new MobyContentInstance(results[0], "param1")); } catch(Exception e){ e.printStackTrace(); fail("Could not serialize the "+TEST_INHERITMEMBER_CLASSNAME+ From kawas at dev.open-bio.org Tue Jul 24 17:26:00 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 24 Jul 2007 13:26:00 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707241726.l6OHQ05W019769@dev.open-bio.org> kawas Tue Jul 24 13:25:59 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19734/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: added 5 subroutines ... create_datatype_cache update_datatype_cache create_service_cache update_service_cache create_cache_dirs These subs help remove the dependency on the java cache. moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2006/10/13 21:51:16 1.1 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:25:59 1.2 @@ -17,6 +17,7 @@ use MOSES::MOBY::Def::Data; use MOSES::MOBY::Def::Namespace; use MOSES::MOBY::Def::Relationship; +use SOAP::Lite; use XML::LibXML; use File::Spec; use strict; @@ -53,6 +54,18 @@ print $cache->cachedir; print $cache->registry(); + # create a cache for datatypes and fill it up + $cache->create_datatype_cache; + + #update the datatype cache + $cache->update_datatype_cache; + + # create a cache for services and fill it up + $cache->create_service_cache; + + #update the services cache + $cache->update_service_cache; + # get a data type called DNASequence my $dna = $cache->get_datatype ('DNASequence'); @@ -182,6 +195,21 @@ } #----------------------------------------------------------------- +# _namespace +# Return a namespace of the $self->registry, or of a given +# registry. +#----------------------------------------------------------------- +sub _namespace { + my ($self, $registry) = @_; + $registry ||= $self->registry; + return $registry if $registry =~ m"^http://"; + my $reg = MOSES::MOBY::Cache::Registries->get ($registry); + return $reg->{namespace} if $reg; + return MOSES::MOBY::Cache::Registries->get ('default')->{namespace}; +} + + +#----------------------------------------------------------------- # init #----------------------------------------------------------------- sub init { @@ -253,6 +281,351 @@ } #----------------------------------------------------------------- +# create_datatype_cache +#----------------------------------------------------------------- + +=head2 create_datatype_cache + +Create the datatype cache. This will over write any pre-existing +cache that it finds. + +Throw an exception if any of the following occur: + * There is a SOAP error calling the registry + * There were write errors on the cache directory or its contents +=cut + +sub create_datatype_cache { + my ($self) = @_; + + # 2 steps: + # -> create a LIST file + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = + $soap->retrieveObjectNames( )->result; + # create cache dirs as needed + $self->create_cache_dirs; + + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + LIST_FILE); + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + + # 2-> foreach datatype store 'retrieveObjectDefinition' + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_string($xml); + + my $nodes = $doc->documentElement()->getChildrenByTagName('Object'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('name'); + my $input =< + $name + +END + $xml = + $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + $name); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + +} + +#----------------------------------------------------------------- +# update_datatype_cache +#----------------------------------------------------------------- + +=head2 update_datatype_cache + +Update the datatype cache. This will update any items that are 'old', +by relying on the LSID for the datatype. + +Throw an exception if any of the following occur: + * A cache to update doesn't exist + * There is a SOAP error calling the registry + * There were read/write errors on the cache directory or its contents + +=cut + +sub update_datatype_cache { + my ($self) = @_; + + my %old_datatypes = (); + my %new_datatypes = (); + my @changed_datatypes = (); + + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE))) { + $self->throw("Datatype cache doesn't exist, so I can't update it. Please create a datatype cache first!"); + } + + # steps: + # read in the LIST file and extract lsids for all datatypes + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + LIST_FILE); + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_file($file); + my $nodes = $doc->documentElement()->getChildrenByTagName('Object'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('name'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $old_datatypes{$name} = $lsid; + } + # get the new LIST file and extract lsids for all datatypes + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = $soap->retrieveObjectNames( )->result; + $parser = XML::LibXML->new(); + $doc = $parser->parse_string($xml); + $nodes = $doc->documentElement()->getChildrenByTagName('Object'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('name'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $new_datatypes{$name} = $lsid; + } + # go through the keys of the new one and if the keys doesnt exist or has been modified, add to 'download' queue + foreach my $dt (keys %new_datatypes) { + next unless !$old_datatypes{$dt} or $old_datatypes{$dt} ne $new_datatypes{$dt}; + push @changed_datatypes, $dt; + } + + # if their where changes, save new LIST file over the old one and get changes + if (scalar @changed_datatypes) { + # save new LIST file + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + # clear used values + $xml = undef; + $file = undef; + $parser = undef; + $doc = undef; + $nodes = undef; + foreach my $name (@changed_datatypes) { + print "Found modified datatype, '$name', updating ...\n"; + my $input =< + $name + +END + $xml = + $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + $name); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + } +} + +#----------------------------------------------------------------- +# create_datatype_cache +#----------------------------------------------------------------- + +=head2 create_datatype_cache + +Create the datatype cache. This will over write any pre-existing +cache that it finds. + +Throw an exception if something bad happens ... TODO explain this better + +=cut + +sub create_service_cache { + my ($self) = @_; + + # 2 steps: + # -> create a LIST file + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = + $soap->retrieveServiceNames( )->result; + # create cache dirs as needed + $self->create_cache_dirs; + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + LIST_FILE); + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + + # 2-> foreach datatype store 'findService' on the authority + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_string($xml); + my %authorities_completed = (); + my $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('authURI'); + next if $authorities_completed{$name}; + $authorities_completed{$name} = 1; + my $input =< + $name + +END + $xml = + $soap->findService ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + $name); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + +} + +#----------------------------------------------------------------- +# update_service_cache +#----------------------------------------------------------------- + +=head2 update_service_cache + +Update the services cache. This will update any items that are 'old', +by relying on the LSID for the datatype. + +Throw an exception if any of the following occur: + * A cache to update doesn't exist + * There is a SOAP error calling the registry + * There were read/write errors on the cache directory or its contents + +=cut + +sub update_service_cache { + my ($self) = @_; + + my %old_services = (); + my %new_services = (); + my %changed_services = (); + + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE))) { + $self->throw("Services cache doesn't exist, so I can't update it. Please create a services cache first!"); + } + + # steps: + # read in the LIST file and extract lsids for all datatypes + my $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + LIST_FILE); + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_file($file); + my $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('authURI'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $old_services{$name}{$lsid} = 1; + } + # get the new LIST file and extract lsids for all datatypes + my $soap = + SOAP::Lite->uri($self->_namespace) + ->proxy( $self->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + $self->throw ("There was a problem calling the registry: " . $self->_endpoint . "\@ " . $self->_namespace . ".\n" + $res); + } + ); + + my $xml = $soap->retrieveServiceNames( )->result; + $parser = XML::LibXML->new(); + $doc = $parser->parse_string($xml); + $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for (1 .. $nodes->size()) { + my $name = $nodes->get_node($_ )->getAttribute('authURI'); + my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); + $new_services{$name}{$lsid} = 1; + } + # go through the keys of the new one and if the keys doesnt exist or has been modified, add to 'download' queue + foreach my $auth (keys %new_services) { + next if $changed_services{$auth}; + foreach my $lsid (keys %{$new_services{$auth}}) { + next unless !$old_services{$auth}{$lsid}; + $changed_services{$auth} = 1; + } + + } + + # if their where changes, save new LIST file over the old one and get changes + if (keys %changed_services) { + # save new LIST file + open (FILE, ">$file") + or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + # clear used values + $xml = undef; + $file = undef; + $parser = undef; + $doc = undef; + $nodes = undef; + foreach my $authURI (keys %changed_services) { + my $input =< + $authURI + +END + $xml = + $soap->findService ( SOAP::Data->type('string' => "$input") )->result; + $file = File::Spec->catfile ($self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + $authURI); + open (FILE, ">$file") or $self->throw ("Can't open file '$file' for writing: $!"); + print FILE $xml; + close FILE; + } + } +} + +#----------------------------------------------------------------- # _createDataTypeFromXML # given xmlString, build a MOSES::MOBY::Def::DataType #----------------------------------------------------------------- @@ -807,5 +1180,38 @@ } +#----------------------------------------------------------------- +# cache_exists +#----------------------------------------------------------------- + +=head2 create_cache_dirs + +Creates the cache directories needed for generating datatypes and services. + +Throws an exception if there are problems creating the directories. + +=cut + +sub create_cache_dirs { + my ($self)= @_; + my @dirs = ( + File::Spec->catfile ($self->cachedir,$self->_clean ($self->_endpoint),DATATYPES_CACHE), + File::Spec->catdir ($self->cachedir,$self->_clean ($self->_endpoint),SERVICES_CACHE), + File::Spec->catdir ($self->cachedir,$self->_clean ($self->_endpoint),NAMESPACES_CACHE), + File::Spec->catdir ($self->cachedir,$self->_clean ($self->_endpoint),SERVICETYPES_CACHE), + ); + + foreach my $file (@dirs) { + my ($v, $d, $f) = File::Spec->splitpath( $file ); + my $dir = File::Spec->catdir($v); + foreach my $part ( File::Spec->splitdir( ($d.$f ) ) ) { + $dir = File::Spec->catdir($dir, $part); + next if -d $dir or -e $dir; + mkdir( $dir ) || $self->throw("Error creating caching directory '".$dir."':\n$!"); + } + } +} + + 1; __END__ From kawas at dev.open-bio.org Tue Jul 24 17:29:38 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 24 Jul 2007 13:29:38 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707241729.l6OHTc94019812@dev.open-bio.org> kawas Tue Jul 24 13:29:38 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19777/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: fixed the documentation, i,e, places where 'something bad happens' have been replaced with the bad thing that would happen ;-) moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:25:59 1.2 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:29:38 1.3 @@ -452,15 +452,17 @@ } #----------------------------------------------------------------- -# create_datatype_cache +# create_service_cache #----------------------------------------------------------------- -=head2 create_datatype_cache +=head2 create_service_cache -Create the datatype cache. This will over write any pre-existing +Create the service cache. This will over write any pre-existing cache that it finds. -Throw an exception if something bad happens ... TODO explain this better +Throw an exception if any of the following occurs: + * A SOAP error as a result of calling the registry + * Problems writing to the cache directory =cut From kawas at dev.open-bio.org Tue Jul 24 22:25:40 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 24 Jul 2007 18:25:40 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707242225.l6OMPegZ020416@dev.open-bio.org> kawas Tue Jul 24 18:25:40 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv20380/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: more error checking added moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 17:29:38 1.3 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 22:25:40 1.4 @@ -312,8 +312,7 @@ my $xml = $soap->retrieveObjectNames( )->result; # create cache dirs as needed - $self->create_cache_dirs; - + $self->create_cache_dirs; my $file = File::Spec->catfile ($self->cachedir, $self->_clean ($self->_endpoint), DATATYPES_CACHE, @@ -322,7 +321,9 @@ or $self->throw ("Can't open file '$file' for writing: $!"); print FILE $xml; close FILE; - + + $LOG->debug("Saving the '". LIST_FILE . "' file."); + # 2-> foreach datatype store 'retrieveObjectDefinition' my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($xml); @@ -335,6 +336,7 @@ $name END + $LOG->debug("Processing the datatype, '$name'."); $xml = $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; $file = File::Spec->catfile ($self->cachedir, @@ -377,9 +379,16 @@ DATATYPES_CACHE))) { $self->throw("Datatype cache doesn't exist, so I can't update it. Please create a datatype cache first!"); } - + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + DATATYPES_CACHE, + LIST_FILE))) { + $self->throw("Datatypes LIST_FILE doesn't exist, so I can't update the cache. Please create a datatype cache first!"); + } # steps: # read in the LIST file and extract lsids for all datatypes + $LOG->debug("Reading the cached '" . LIST_FILE ."'."); my $file = File::Spec->catfile ($self->cachedir, $self->_clean ($self->_endpoint), DATATYPES_CACHE, @@ -392,6 +401,7 @@ my $lsid = $nodes->get_node($_ )->getAttribute('lsid'); $old_datatypes{$name} = $lsid; } + $LOG->debug("Retrieving an up to date '". LIST_FILE ."'."); # get the new LIST file and extract lsids for all datatypes my $soap = SOAP::Lite->uri($self->_namespace) @@ -416,6 +426,7 @@ foreach my $dt (keys %new_datatypes) { next unless !$old_datatypes{$dt} or $old_datatypes{$dt} ne $new_datatypes{$dt}; push @changed_datatypes, $dt; + $LOG->debug("The datatype, '$dt', seems to have been modified."); } # if their where changes, save new LIST file over the old one and get changes @@ -438,6 +449,8 @@ $name END + + $LOG->debug("Updating the datatype, '$name'."); $xml = $soap->retrieveObjectDefinition ( SOAP::Data->type('string' => "$input") )->result; $file = File::Spec->catfile ($self->cachedir, @@ -550,6 +563,14 @@ SERVICES_CACHE))) { $self->throw("Services cache doesn't exist, so I can't update it. Please create a services cache first!"); } + + if (!(-e File::Spec->catfile ( + $self->cachedir, + $self->_clean ($self->_endpoint), + SERVICES_CACHE, + LIST_FILE))) { + $self->throw("Services LIST_FILE doesn't exist, so I can't update the cache. Please create a services cache first!"); + } # steps: # read in the LIST file and extract lsids for all datatypes @@ -1210,6 +1231,7 @@ $dir = File::Spec->catdir($dir, $part); next if -d $dir or -e $dir; mkdir( $dir ) || $self->throw("Error creating caching directory '".$dir."':\n$!"); + $LOG->debug("creating the directory, '$dir'."); } } } From gordonp at dev.open-bio.org Fri Jul 27 21:44:22 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 17:44:22 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707272144.l6RLiM5j026320@dev.open-bio.org> gordonp Fri Jul 27 17:44:22 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv26284/src/main/org/biomoby/shared/data Modified Files: MobyDataObject.java Log Message: Made articleName searching deeper: if encapsulating simple tag doesn't name an item (e.g. when in a collection), try grabbing the name from the object element itself moby-live/Java/src/main/org/biomoby/shared/data MobyDataObject.java,1.18,1.19 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/07/06 22:11:01 1.18 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/07/27 21:44:21 1.19 @@ -256,6 +256,11 @@ // A top level object whose name is in the enclosing simple tag if(p != null && (p instanceof Element) && ((Element) p).getTagName().equals(MobyTags.SIMPLE)){ name = MobyPrefixResolver.getAttr((Element) p, MobyTags.ARTICLENAME); + if(name != null && name.length() > 0){ + return name; + } + // If the simple doesn't have a name, grab the name from the child tag + name = MobyPrefixResolver.getAttr(e, MobyTags.ARTICLENAME); return name == null ? "" : name; } // Part of a composite, subobject's name is in its own tag From gordonp at dev.open-bio.org Fri Jul 27 21:45:13 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 17:45:13 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707272145.l6RLjDBZ026366@dev.open-bio.org> gordonp Fri Jul 27 17:45:13 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv26330/src/main/org/biomoby/shared/data Modified Files: MobyDataObjectSet.java Log Message: Fixed neaest-common-acestor determination algorithm when one object is shallow moby-live/Java/src/main/org/biomoby/shared/data MobyDataObjectSet.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2007/06/07 23:58:15 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2007/07/27 21:45:13 1.9 @@ -109,10 +109,11 @@ } else{ for(int i = 0; i < lineage.length; i++){ - if(!lineage[i].equals(objLineage[i])){ + if(i >= objLineage.length || !lineage[i].equals(objLineage[i])){ // start of different family tree, truncate common lineage here lineage = new MobyDataType[i]; System.arraycopy(objLineage, 0, lineage, 0, i); + break; //would happen anyway due to lineage resize, but let's make it explicit } } } From gordonp at dev.open-bio.org Sat Jul 28 03:38:41 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:38:41 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280338.l6S3cftx026754@dev.open-bio.org> gordonp Fri Jul 27 23:38:41 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26718/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentGUI.java Log Message: Clipboard now always visible, even at startup moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentGUI.java,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/06/16 19:34:36 1.12 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/07/28 03:38:41 1.13 @@ -211,6 +211,8 @@ dataRecorder, status); getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER); + tabbedPane.add(clipboard); + clipboard.init(); settingsGUI = new SeahawkOptionsGUI(this); } @@ -299,12 +301,13 @@ catch(TransformerConfigurationException tce){ MobyContentPane tab = createTab("Initialization Error"); tab.failed("Initialization Error"); - tab.getDisplay().setText("Cannot continue: could not create XML transformer (either stylesheet has an error, or no JAXT implementation is available"); - logger.error("Cannot continue: could not create XML transformer: " + tce); + tab.getDisplay().setText("Cannot continue: could not create XML transformer (either stylesheet has an error, or no JAXT implementation is available\n"); + logger.error("Cannot continue: could not create XML transformer: " + tce); + tce.printStackTrace(); } setVisible(true); - tabbedPane.add(clipboard); + //tabbedPane.add(clipboard); int clipboardIndex = tabbedPane.indexOfComponent(clipboard); if(clipboardIndex != -1){ tabbedPane.setToolTipTextAt(clipboardIndex, CLIPBOARD_TAB_TOOLTIP); From gordonp at dev.open-bio.org Sat Jul 28 03:40:19 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:40:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280340.l6S3eJjQ026820@dev.open-bio.org> gordonp Fri Jul 27 23:40:18 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26784/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentPane.java Log Message: Added article name to popup data display, other minor edits moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentPane.java,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2007/06/18 20:01:12 1.12 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2007/07/28 03:40:18 1.13 @@ -218,7 +218,7 @@ boolean unformatted = false; // It's XML that needs to be transformed to HTML - if(urlString.lastIndexOf(".xml") == urlString.length()-4 || + if(urlString.endsWith(".xml") || "text/xml".equals(urlCon.getContentType())){ editorPane.setContentType("text/html"); isContentsXML = true; @@ -792,7 +792,8 @@ String query = targetURL.getQuery(); String mobyID = null; String mobyString = null; - + String mobyName = ""; + MobyDataObject mobyData = null; // extract the ID or string value @@ -809,7 +810,7 @@ mobyID = ""; } } - else if(mobyString == null && token.startsWith("string=") && token.length() > 7){ + else if(mobyString == null && token.startsWith("string=") && token.length() >= 7){ if(token.length() > 7){ mobyString = token.substring(7); } @@ -817,6 +818,14 @@ mobyString = ""; } } + else if(mobyName.length() == 0 && token.startsWith("name=") && token.length() >= 5){ + if(token.length() > 5){ + mobyName = token.substring(5); + } + else{ + mobyName = ""; + } + } else{ logger.warn("Warning: unrecognized or duplicate query part '" + token + "' in moby link " + targetURL); @@ -826,10 +835,10 @@ } if(mobyString != null){ - mobyData = new MobyDataString("", mobyString, SeahawkOptions.getRegistry()); + mobyData = new MobyDataString(mobyName, mobyString, SeahawkOptions.getRegistry()); } else{ - mobyData = new MobyDataObject("", SeahawkOptions.getRegistry()); + mobyData = new MobyDataObject(mobyName, SeahawkOptions.getRegistry()); } mobyData.addNamespace(MobyNamespace.getNamespace(namespace, SeahawkOptions.getRegistry())); @@ -1094,6 +1103,6 @@ public void keyTyped(KeyEvent e){} public void paste(){ - getTransferHandler().importData(editorPane, java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this)); + getTransferHandler().importData(this, java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this)); } } From gordonp at dev.open-bio.org Sat Jul 28 03:42:00 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:42:00 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280342.l6S3g0Wa026864@dev.open-bio.org> gordonp Fri Jul 27 23:42:00 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26828/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentClipboard.java Log Message: Made the clipboard 'smart', pasted data is automatically converted to MOBY Objects and append to clipboard collection moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentClipboard.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2007/06/08 14:04:27 1.4 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2007/07/28 03:42:00 1.5 @@ -1,16 +1,15 @@ package ca.ucalgary.seahawk.gui; -import ca.ucalgary.seahawk.util.DataRecorder; +import ca.ucalgary.seahawk.services.MobyClient; +import ca.ucalgary.seahawk.util.*; import org.biomoby.client.MobyRequestEventHandler; +import org.biomoby.shared.MobyDataType; import org.biomoby.shared.data.*; +import org.biomoby.shared.parser.MobyTags; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.JTabbedPane; +import javax.swing.*; import javax.xml.transform.Transformer; import javax.xml.parsers.DocumentBuilder; @@ -42,6 +41,7 @@ private File clipboardFile; private MobyDataJob query; // lump all data into one query private MobyDataObjectSet collection; // lump all data into one collection + private String previousImportDataType = null; // Clipboard editing variables private JMenuItem deleteDataPopupItem; @@ -82,7 +82,12 @@ return; } clipboardFile.deleteOnExit(); - + + // The dfeault is to open a new tab when contents is transfered (dropped/pasted) onto the tab, + // we want to override that behaviour to a collation for the clipboard + setTransferHandler(new FileAndTextTransferHandler(cGUI, false)); // false = open data in current tab + editorPane.setTransferHandler(getTransferHandler()); + sGUI.setClipboard(this); } @@ -112,6 +117,9 @@ // Only process if the passed in data is one of the top level collection elements // (i.e. don't delete subparts of object) if(!(mdi instanceof MobyDataObject) || !collection.contains(mdi)){ + mdi.setXmlMode(MobyDataInstance.SERVICE_XML_MODE); + System.err.println("Skipping " + mdi.toXML()); + mdi.setXmlMode(MobyDataInstance.CENTRAL_XML_MODE); return; } @@ -156,6 +164,10 @@ * @param mdi the data to be added to the main clipboard collection */ public void addCollectionData(MobyDataInstance mdi){ + addCollectionData(mdi, true); + } + + public void addCollectionData(MobyDataInstance mdi, boolean updateDisplay){ if(mdi == null){ logger.warn("Cannot add null object to the clipboard."); return; @@ -177,9 +189,125 @@ return; } + if(updateDisplay){ + updateDisplay(); + } + } + + /** + * Objects in the content instance will be flattened into a list + * and appended to the current contents of the collection. + */ + public void addCollectionData(MobyContentInstance mci){ + for(MobyDataJob job: mci.values()){ + for(MobyDataInstance data: job.getPrimaryData()){ + addCollectionData(data, false); //false == don't update display + } + } updateDisplay(); } + /** + * Attempts to add data from the given URL as MOBY objects (converting if necessary). + * The conversion is "smart", and so if you have 2 DNASequences on the clipboard + * already, it will try to extract DNASequences from the URL data first, then other + * types. + */ + public void addCollectionData(URL u){ + try{ + MobyContentInstance mobyContents = + MobyUtils.convertURLtoMobyBinaryData(servicesGUI.getMobyClient(), u); + if(mobyContents != null){ + addCollectionData(mobyContents); + return; + } + } catch(Exception e){ + logger.warn("Could not transform binary file ("+u+"): " + e); + } + + // Not binary, see if it's text that's convertible to MOBY data + MobyClient client = servicesGUI.getMobyClient(); + if(client == null){ + logger.warn("Could not get MOBY client from MOBY services GUI, " + + "cannot transform incoming clipboard data to MOBY objects"); + } + String urlContents = null; + try{ + urlContents = HTMLUtils.getURLContents(u); + } catch(Exception e){ + logger.warn("Could not read contents of the URL to import to the clipboard ("+u+"):" +e); + return; + } + + MobyDataType targetDataType = null; + if(collection != null){ + targetDataType = collection.getDataType(); + } + MobyDataObject[] mobyDataFound = client.getMobyObjects(urlContents, targetDataType); + // If only one data available, use it + if(mobyDataFound.length == 1){ + addCollectionData(mobyDataFound[0]); + return; + } + // If no data available, try a more general object finding query + else if(mobyDataFound.length == 0){ + // If the previous transformation attempt was for the base Object, there's + // nothing more to search for, just treat the data as a string. + if(targetDataType == null || MobyTags.MOBYOBJECT.equals(targetDataType.getName())){ + addCollectionData(new MobyDataString(urlContents)); + return; + } + mobyDataFound = client.getMobyObjects(urlContents); + if(mobyDataFound.length == 1){ + addCollectionData(mobyDataFound[0]); + return; + } + else if(mobyDataFound.length == 0){ + addCollectionData(new MobyDataString(urlContents)); + return; + } + } + // Otherwise we need to ask the user what data to import ("Paste as...") + // Implicitly...mobyDataFound.length > 1 + String[] selectionValues = new String[mobyDataFound.length]; + for(int i = 0; i < mobyDataFound.length; i++){ + selectionValues[i] = mobyDataFound[i].getDataType().getName(); + if(MobyTags.MOBYOBJECT.equals(selectionValues[i]) && + mobyDataFound[i].getPrimaryNamespace() != null){ + selectionValues[i] += " (" + mobyDataFound[i].getPrimaryNamespace().getName() + ")"; + } + } + // Sort alphabetically + //Arrays.sort(selectionValues); + String initialSelectionValue = selectionValues[0]; + if(previousImportDataType != null){ + for(String selectionValue: selectionValues){ + if(previousImportDataType.equals(selectionValue)){ + initialSelectionValue = selectionValue; + break; + } + } + } + String selection = (String) JOptionPane.showInputDialog(this, + "Paste data as...", + "Data import choice", + JOptionPane.PLAIN_MESSAGE, + (Icon) null, + selectionValues, + initialSelectionValue); + if(selection == null){ + logger.warn("No data type for import selected, abandoning import"); + return; + } + for(int i = 0; i < selectionValues.length; i++){ + if(selection.equals(selectionValues[i])){ + addCollectionData(mobyDataFound[i]); + previousImportDataType = selection; + return; + } + } + } + public boolean hasXMLSource(){ return true; } From gordonp at dev.open-bio.org Sat Jul 28 03:43:24 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:43:24 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280343.l6S3hOFX026908@dev.open-bio.org> gordonp Fri Jul 27 23:43:24 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv26872/src/main/ca/ucalgary/seahawk/gui Modified Files: FileAndTextTransferHandler.java Log Message: Added support for passing data to the clipboard for appending, rather than just opening a new tab with the pasted data moby-live/Java/src/main/ca/ucalgary/seahawk/gui FileAndTextTransferHandler.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2007/06/08 14:04:27 1.6 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2007/07/28 03:43:24 1.7 @@ -25,9 +25,18 @@ public class FileAndTextTransferHandler extends TransferHandler { private DataFlavor fileFlavor, stringFlavor; private MobyContentGUI gui; + private boolean openDataInNewTab; + /** + * By default, opens pasted data in a new tab of the GUI + */ public FileAndTextTransferHandler(MobyContentGUI mcg) { + this(mcg, true); + } + + public FileAndTextTransferHandler(MobyContentGUI mcg, boolean openNewDataInNewTab) { gui = mcg; + openDataInNewTab = openNewDataInNewTab; fileFlavor = DataFlavor.javaFileListFlavor; stringFlavor = DataFlavor.stringFlavor; } @@ -38,6 +47,20 @@ return false; } + // The clipboard is a special case: we want to append data, + // not replace (also assuming you told us not to open data in a new tab). + MobyContentClipboard clipboard = null; + if(!openDataInNewTab){ + for(Component container = c; + container != null; + container = container.getParent()){ + if(container instanceof MobyContentClipboard){ + clipboard = (MobyContentClipboard) container; + break; + } + } + } + // Should be done in another thread to not block UI try { if (hasFileFlavor(t.getTransferDataFlavors())) { @@ -48,12 +71,22 @@ // Was it a shortcut file after all? if(u != null){ System.err.println("Dropped item appears to be a URL shortcut..."); - gui.loadPaneFromURL(u, true); + if(clipboard != null){ + clipboard.addCollectionData(u); + } + else{ + gui.loadPaneFromURL(u, openDataInNewTab); + } } // Any other type of file is loaded as-is else{ System.err.println("Dropped item appears to be a file..."); - gui.loadPaneFromURL(file.toURI().toURL(), true); + if(clipboard != null){ + clipboard.addCollectionData(file.toURI().toURL()); + } + else{ + gui.loadPaneFromURL(file.toURI().toURL(), openDataInNewTab); + } } } return true; @@ -74,16 +107,33 @@ } if(u != null){ System.err.println("Dropped item appears to be a URL..."); - gui.loadPaneFromURL(u, true); + if(clipboard != null){ + clipboard.addCollectionData(u); + } + else{ + gui.loadPaneFromURL(u, openDataInNewTab); + } return true; } + // For the purposes of the clipboard, if it's not a URL, we want to parse + // the text fopr MOBY data, rather than display the HTML or RTF, etc. + if(clipboard != null){ + boolean PLAIN_TEXT = true; + text = convertToString(t, PLAIN_TEXT); + } + // If the text looks like a MOBY XML payload, be nice and create // the proper object to load MobyContentInstance content = HTMLUtils.checkForMobyXML(text); if(content != null){ System.err.println("Dropped item appears to be moby xml..."); - gui.loadPaneFromObject(content, true); + if(clipboard != null){ + clipboard.addCollectionData(content); + } + else{ + gui.loadPaneFromObject(content, openDataInNewTab); + } return true; } @@ -117,7 +167,12 @@ out.write(text.getBytes()); } out.close(); - gui.loadPaneFromURL(savedFile.toURI().toURL(), true); + if(clipboard != null){ + clipboard.addCollectionData(savedFile.toURI().toURL()); + } + else{ + gui.loadPaneFromURL(savedFile.toURI().toURL(), openDataInNewTab); + } return true; } else{ From gordonp at dev.open-bio.org Sat Jul 28 03:45:31 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:45:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280345.l6S3jVHx026974@dev.open-bio.org> gordonp Fri Jul 27 23:45:31 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util In directory dev.open-bio.org:/tmp/cvs-serv26938/src/main/ca/ucalgary/seahawk/util Modified Files: HTMLUtils.java Log Message: Made binary data encapsulation more robust moby-live/Java/src/main/ca/ucalgary/seahawk/util HTMLUtils.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java 2007/06/08 14:04:27 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java 2007/07/28 03:45:31 1.4 @@ -8,50 +8,65 @@ import java.io.*; import java.net.*; - +import java.util.Vector; public class HTMLUtils{ public final static String BINARY_DATA_LABEL = "[binary data not shown]"; - public final static String ACCEPTABLE_IMAGE_DATATYPE = "WebFormatImage"; //from the ontology + public final static String ACCEPTABLE_IMAGE_DATATYPE = "WebFormatImage"; //from the ontology, should eventually be configurable public static String encapsulateBinaryData(URL sourceMobyData, String html) throws Exception{ MobyContentInstance dataPackage = MobyDataUtils.fromXMLDocument(sourceMobyData); // Look for binary data and replace it with an image ref (if its an image // displayable in our viewer), or simply "(binary data)". for(MobyDataJob job: dataPackage.values()){ - for(MobyDataInstance data: job.values()){ - if(data instanceof MobyDataBytes){ - MobyDataBytes binaryMobyObject = (MobyDataBytes) data; - //System.err.println("Replacing binary data in display of "+binaryMobyObject.getName()); - - String encodedData = binaryMobyObject.get(MobyDataBytes.ENCODED_MEMBER_NAME) - .getValue().toString(); - if(html.indexOf(encodedData) == -1){ - System.err.println("Could not find the encoded data in the html given!!!"); - } - - // if an image, save and show it - if(binaryMobyObject.getDataType().inheritsFrom(ACCEPTABLE_IMAGE_DATATYPE)){ - String imgSuffix = binaryMobyObject.getDataType().getName(); - if(imgSuffix.length() < 3){ - imgSuffix = ".img"; + for(MobyDataInstance primary: job.values()){ + Iterable values = null; + if(primary instanceof MobyDataObjectSet || + primary instanceof MobyDataObjectVector){ + values = (Iterable) primary; + } + else if(primary instanceof MobyDataObject){ + values = new Vector(); + ((Vector) values).add((MobyDataObject) primary); + } + else{ + // ignore secondaries, they can't be binary + continue; + } + for(MobyDataObject data: values){ + if(data instanceof MobyDataBytes){ + MobyDataBytes binaryMobyObject = (MobyDataBytes) data; + //System.err.println("Replacing binary data in display of "+binaryMobyObject.getName()); + + String encodedData = binaryMobyObject.get(MobyDataBytes.ENCODED_MEMBER_NAME) + .getValue().toString(); + if(html.indexOf(encodedData) == -1){ + System.err.println("Could not find the encoded data in the html given!!!"); } + + // if an image, save and show it + if(binaryMobyObject.getDataType().inheritsFrom(ACCEPTABLE_IMAGE_DATATYPE)){ + String imgSuffix = binaryMobyObject.getDataType().getName(); + if(imgSuffix.length() < 3){ + imgSuffix = ".img"; + } + else{ + imgSuffix = "."+imgSuffix.substring(0, 3).toLowerCase(); + } + File imageFile = File.createTempFile("seahawkSavedImage", imgSuffix); + imageFile.deleteOnExit(); + + FileOutputStream fos = new FileOutputStream(imageFile); + fos.write(binaryMobyObject.getBytes()); + fos.close(); + + html = html.replace(encodedData, "
    "); + } + // Otherwise put a placeholder else{ - imgSuffix = "."+imgSuffix.substring(0, 3).toLowerCase(); + html = html.replace(encodedData, BINARY_DATA_LABEL); } - File imageFile = File.createTempFile("seahawkSavedImage", imgSuffix); - imageFile.deleteOnExit(); - - FileOutputStream fos = new FileOutputStream(imageFile); - fos.write(binaryMobyObject.getBytes()); - fos.close(); - - html = html.replace(encodedData, "
    "); - } - // Otherwise put a placeholder - else{ - html = html.replace(encodedData, BINARY_DATA_LABEL); } } } @@ -154,9 +169,13 @@ MobyContentInstance content = null; String xmltext = text; + if(xmltext.indexOf("??") == 0){ + xmltext = xmltext.substring(2); + } + // See if the xml needs unescaping (e.g. if preformatted HTML dropped from Firefox or Thunderbird) int preStart = xmltext.indexOf("")+1); @@ -196,10 +215,20 @@ } } catch(Exception e){ e.printStackTrace(); - System.err.println("This issue may be related to your choice of registry ("+ + System.err.println("This issue may or may not be related to your choice of registry ("+ (SeahawkOptions.getRegistry() == null ? "MOBY default" : SeahawkOptions.getRegistry().getSynonym()) +")"); + System.err.println(xmltext); } return content; } + + public static String getURLContents(URL u) throws Exception{ + StringBuffer buffer = new StringBuffer(); + LineNumberReader reader = new LineNumberReader(new InputStreamReader(u.openStream())); + for(String line = reader.readLine(); line != null; line = reader.readLine()){ + buffer.append(line); + } + return buffer.toString(); + } } From gordonp at dev.open-bio.org Sat Jul 28 03:46:16 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:46:16 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280346.l6S3kGPe027018@dev.open-bio.org> gordonp Fri Jul 27 23:46:16 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services In directory dev.open-bio.org:/tmp/cvs-serv26982/src/main/ca/ucalgary/seahawk/services Modified Files: MobyClient.java Log Message: Made less verbose moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyClient.java,1.15,1.16 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java 2007/06/28 16:45:44 1.15 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java 2007/07/28 03:46:16 1.16 @@ -586,13 +586,15 @@ /** * Using the regular expression mappings that have been set up, * maps a string using rules producing moby objects of the given type. + * @param targetDataType matches any data type if null, otherwise restricts returned items to those that are of (or inherit from) the given type */ public MobyDataObject[] getMobyObjects(String textData, MobyDataType targetDataType){ Vector objectVector = new Vector(); for(Pattern pattern: regexMap.keySet()){ MobyComplexBuilder rule = regexMap.get(pattern); - if(rule.getDataType().inheritsFrom(targetDataType)){ + if(targetDataType == null || + rule.getDataType().inheritsFrom(targetDataType)){ Matcher matcher = pattern.matcher(textData); while(matcher.find()){ @@ -1212,7 +1214,7 @@ throw new Exception("Cannot find definition of data type "+mobyDataType+ " in the ontology, therefore the rule cannot be properly parsed"); } - MobyRelationship[] memberRelationships = dataType.getChildren(); + MobyRelationship[] memberRelationships = dataType.getAllChildren(); String newRegexp = processRegExp(regexp, membersMap); Map captured = new HashMap(); @@ -1221,7 +1223,7 @@ String[] rule = membersMap.get(memberRelationship.getName()); if(rule == null){ System.err.println("Skipping HAS member "+memberRelationship.getName() + - " without a rule"); + " without an explicit rule (may be defined by inheritance?)"); continue; } Pattern pattern = Pattern.compile(newRegexp, Pattern.DOTALL | Pattern.COMMENTS); @@ -1268,10 +1270,10 @@ } // end for(group count) } // end if (member's relationship is HAS) else{ - System.err.println("Relationship for member " + memberRelationship.getName() + " of "+ mobyDataType + - "is *not* HAS"); + //System.err.println("Relationship for member " + memberRelationship.getName() + " of "+ mobyDataType + + // "is *not* HAS"); } - } //end for(member replationships) + } //end for(member relationships) return newRegexp; } From gordonp at dev.open-bio.org Sat Jul 28 03:47:07 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:47:07 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280347.l6S3l78B027062@dev.open-bio.org> gordonp Fri Jul 27 23:47:07 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources In directory dev.open-bio.org:/tmp/cvs-serv27026/src/main/ca/ucalgary/seahawk/resources Modified Files: mobyBuilderRules.xml Log Message: Simplified DNA/AA MOB rules moby-live/Java/src/main/ca/ucalgary/seahawk/resources mobyBuilderRules.xml,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml 2007/06/08 14:04:27 1.5 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml 2007/07/28 03:47:07 1.6 @@ -6,24 +6,24 @@ - (\N*\s*(\N{10,}(?:\x20|\r|\t|\n)?)+\N*) + \N*\s*(?:\N{10,}(?:\x20|\r|\t|\n)*)+\N* '' - $1 - string-length('$1') + $0 + string-length('$0') - (\P*\s*(\P{10,}(?:\x20|\r|\t|\n)?)+\P*) + \P*\s*(?:\P{10,}(?:\x20|\r|\t|\n)*)+\P* '' - $1 - string-length('$1') + $0 + string-length('$0') From gordonp at dev.open-bio.org Sat Jul 28 03:47:41 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:47:41 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280347.l6S3lfTS027106@dev.open-bio.org> gordonp Fri Jul 27 23:47:41 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources In directory dev.open-bio.org:/tmp/cvs-serv27070/src/main/ca/ucalgary/seahawk/resources Modified Files: moby2HTML.xsl Log Message: Added articleName support for moby URLs moby-live/Java/src/main/ca/ucalgary/seahawk/resources moby2HTML.xsl,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/moby2HTML.xsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/moby2HTML.xsl 2007/06/16 00:28:57 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/moby2HTML.xsl 2007/07/28 03:47:41 1.4 @@ -218,22 +218,17 @@ - ID : () + ID : () - ID : ():
    + String : ():
    - - - + :
    @@ -255,8 +250,9 @@ - - Collection of data elements:
    + + + Collection of data elements

    1. From gordonp at dev.open-bio.org Sat Jul 28 03:50:47 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 27 Jul 2007 23:50:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707280350.l6S3olwd027172@dev.open-bio.org> gordonp Fri Jul 27 23:50:47 EDT 2007 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv27136/xmls Modified Files: seahawkBuild.xml Log Message: Change to reflect move of splasher to own package (done to allow independent splasher and main jar loading) moby-live/Java/xmls seahawkBuild.xml,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2007/06/16 00:44:51 1.10 +++ /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2007/07/28 03:50:47 1.11 @@ -4,7 +4,7 @@ - + @@ -13,12 +13,12 @@ - - + + - - + + From gordonp at dev.open-bio.org Mon Jul 30 13:54:06 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 30 Jul 2007 09:54:06 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707301354.l6UDs6GN005665@dev.open-bio.org> gordonp Mon Jul 30 09:54:05 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services In directory dev.open-bio.org:/tmp/cvs-serv5629/src/main/ca/ucalgary/services Modified Files: ACDService.java Log Message: Updated library path inclusion for EMBOSS moby-live/Java/src/main/ca/ucalgary/services ACDService.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/ACDService.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/ACDService.java 2007/04/18 15:53:58 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/ACDService.java 2007/07/30 13:54:05 1.4 @@ -102,7 +102,7 @@ "Valid choices from this run are:" + paramChoices); } - // Transform the buts of binary data into a MOBY object or collection + // Transform the bits of binary data into a MOBY object or collection MobyDataInstance mdi = null; try{ mdi = mobyClient.getMobyObject(resultParts, mobyOutputTemplate); @@ -307,15 +307,14 @@ * @return the standard output of the command */ private String runProgram(MobyDataJob request, String[] command, File workingDir, final byte[] input) throws Exception{ - // TODO: ensure $embossRootDirName/lib is in the LD_LIBRARY_PATH, - // what is the equivalent in Windows? - //for(String cmdpart: command){ - // System.err.print(cmdpart+" "); - //} - //System.err.println(""); + // Ensure $embossRootDirName/lib is in the LD_LIBRARY_PATH, + // what is the equivalent in Windows? Windows searches just PATH... + String libDir = embossRootDirName+File.separator+"lib"; final Process process = runtime.exec(command, new String[]{"EMBOSS="+embossRootDirName, - "EMBOSS_ACDROOT="+acdRootDirName}, + "EMBOSS_ACDROOT="+acdRootDirName, + "LD_LIBRARY_PATH="+libDir, + "PATH="+libDir}, workingDir); final OutputStream stdin = process.getOutputStream(); final InputStream stderr = process.getErrorStream(); From pieter at dev.open-bio.org Tue Jul 31 12:29:16 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Tue, 31 Jul 2007 08:29:16 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707311229.l6VCTGoq009943@dev.open-bio.org> pieter Tue Jul 31 08:29:15 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv9908 Modified Files: Central.pm Log Message: Fixed small type in documentation for MOBY::Client::Central.pm moby-live/Perl/MOBY/Client Central.pm,1.148,1.149 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.148 retrieving revision 1.149 diff -u -r1.148 -r1.149 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/06/27 15:47:33 1.148 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/07/31 12:29:15 1.149 @@ -1305,7 +1305,7 @@ Usage : $types = $MOBY->retrieveServiceTypesFull(%args) Function : get all details of all service types - Returns : hashref of $types{$type} = {definition => "definition", + Returns : hashref of $types{$type} = {Description => "definition", authURI => "authority.uri.here", contactEmail => "email at addy.here"} Args : registry => $reg_name: name of registry you wish to retrieve from (optional) From pieter at dev.open-bio.org Tue Jul 31 13:48:31 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Tue, 31 Jul 2007 09:48:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707311348.l6VDmVKQ010144@dev.open-bio.org> pieter Tue Jul 31 09:48:30 EDT 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv10105 Modified Files: DataClassOntology.html SecondaryArticle.html Log Message: Updated documentation for valid boolean values in primitives and secondaries. moby-live/Docs/MOBY-S_API DataClassOntology.html,1.9,1.10 SecondaryArticle.html,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/DataClassOntology.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/DataClassOntology.html 2007/02/22 16:22:24 1.9 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/DataClassOntology.html 2007/07/31 13:48:30 1.10 @@ -55,11 +55,11 @@
      - -

      -The MOBY Data Class Ontology

      +

      The MOBY Data Class Ontology

      +

      "Standard" Objects

      + In the BioMOBY system, all datatypes (Classes) are defined in an ontology, where each node represents a named Class, and each arc represents one of two @@ -69,13 +69,7 @@ "Object" Class, and (with the exception of the special-case primitives) may contain other objects which themselves inherit -from the "Object" Class. This includes all primitive datatypes such -as integers (class Integer), floating point numbers (class Float), -dates and times (DateTime), -and strings (class String). The class DateTime -uses the W3C profile of the ISO-8601 specification for -specifying dates and times.

      +from the "Object" Class.

      Given this structure, the relationship between any two objects can be described in an RDF triple (subject1, predicate, subject2). @@ -94,21 +88,21 @@

         <Foo namespace="" id="" >

      - -Another example of direct inheritence from the Object class is found -in the classes representing primitives such as integers, floating -point number, strings, and so on. The following RDF triple describes -the Integer object: -

        Integer - ISA - Object
      -and as XML takes on the following structure: -
      -  <Integer namespace="" id="" >966754</Integer>
      -
      -

      +

      "Primitive" Objects

      + +The BioMOBY Class ontology contains five special case primitives: + +

      -Notice, these primitive types are the only cases where the content -of the element is meant to be interpreted by the client or service. +These primitive types are special as they are the only cases where the content +of an element is meant to be interpreted by the client or service. New classes MUST NOT inherit from the Primitive Classes. To obtain content in another class, you must be a container of a primitive class. The two relationship types - HASA and HAS - are used @@ -118,7 +112,17 @@ parent object. HASA indicates that a single instance of the object is contained, while HAS indicates that multiple instances of the object are contained. + +The following RDF triple describes +the Integer object: +

        Integer - ISA - Object
      + +and as XML takes on the following structure: +
      +  <Integer namespace="" id="" >966754</Integer>
      +

      +

      For example, one might imagine a PlainText Object Class that needs to contain some stringified content. This @@ -136,8 +140,21 @@ </moby:String> </moby:PlainText> +

      +

      +The DateTime class uses the +W3C profile of the ISO-8601 specification +for specifying dates and times. +

      +

      +The Boolean class uses the +XML schema definition for valid boolean values. +Hence BioMOBY clients and services can send one of the following literals {true, false, 1, 0} +and must understand all of {true, false, 1, 0}. Other commonly used boolean values like {T,F,TRUE,FALSE} etc. +are not supported and illegal in BioMOBY lingua. +

      =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/SecondaryArticle.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/SecondaryArticle.html 2006/11/21 23:04:27 1.9 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/SecondaryArticle.html 2007/07/31 13:48:30 1.10 @@ -117,8 +117,8 @@

      The components of the Parameter specification are:

        -
      • datatype - one of Integer, Boolean, Float, - String, DateTime, which specifies the type of data +
      • datatype - one of Integer, Boolean, Float, + String, DateTime, which specifies the type of data involved
      • description - a description of this parameter.
      • default - an optional default value, in case none is specified
      • @@ -131,6 +131,20 @@

      +

      +DateTime secondaries use the +W3C profile of the ISO-8601 specification +for specifying dates and times. +

      + +

      +Boolean secondaries use the +XML schema definition for valid boolean values. +Hence BioMOBY clients and services can send one of the following literals {true, false, 1, 0} +and must understand all of {true, false, 1, 0}. Other commonly used boolean values like {T,F,TRUE,FALSE} etc. +are not supported and illegal in BioMOBY lingua. +

      +
      From kawas at dev.open-bio.org Tue Jul 31 17:51:42 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 31 Jul 2007 13:51:42 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200707311751.l6VHpgQZ010457@dev.open-bio.org> kawas Tue Jul 31 13:51:42 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv10422/Java/src/Perl/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: fixed the pod documentation moby-live/Java/src/Perl/MOSES/MOBY/Cache Central.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/24 22:25:40 1.4 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Central.pm 2007/07/31 17:51:42 1.5 @@ -290,8 +290,9 @@ cache that it finds. Throw an exception if any of the following occur: - * There is a SOAP error calling the registry - * There were write errors on the cache directory or its contents + * There is a SOAP error calling the registry + * There were write errors on the cache directory or its contents + =cut sub create_datatype_cache { @@ -360,9 +361,9 @@ by relying on the LSID for the datatype. Throw an exception if any of the following occur: - * A cache to update doesn't exist - * There is a SOAP error calling the registry - * There were read/write errors on the cache directory or its contents + * A cache to update doesn't exist + * There is a SOAP error calling the registry + * There were read/write errors on the cache directory or its contents =cut @@ -474,8 +475,8 @@ cache that it finds. Throw an exception if any of the following occurs: - * A SOAP error as a result of calling the registry - * Problems writing to the cache directory + * A SOAP error as a result of calling the registry + * Problems writing to the cache directory =cut @@ -758,7 +759,6 @@ is defined by the C (and optionally by the C) parameters given in the constructor of this instance. - =cut sub get_datatype_names { @@ -823,6 +823,7 @@ An argument is one or more data types (C) whose related data types are looked for. + =cut sub get_related_types { @@ -912,6 +913,7 @@ @services = $cache->get_services ('samples.jmoby.net', qw ( HelloBiomobyWorld Mabuhay )); or + @services = $cache->get_services ('samples.jmoby.net', 'Mabuhay'); =cut From jmrc at dev.open-bio.org Wed Jul 18 10:47:30 2007 From: jmrc at dev.open-bio.org (José Manuel Rodríguez Carrasco) Date: Wed, 18 Jul 2007 10:47:30 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181047.l6IAlONf028391@dev.open-bio.org> jmrc Wed Jul 18 06:47:24 EDT 2007 Update of /home/repository/moby/moby-live/Perl In directory dev.open-bio.org:/tmp/cvs-serv28328/Perl Modified Files: Makefile.PL Log Message: Description: Perl/MOBY/Makefile.PL We try to add WSRF::Lite version (0.8.2.1) but it is not declared in the proper way there. Perl/MOBY/Central.pm The WSDL template has been remade for asynchronous services. In the last version, it had a mix of RPC/encoded and document/literal in the only binding it had. The solution has been distributing the operations on two disjunctive port types and bindings, one for RPC/encoded operations and the other for document/literal operations. In that way, the service has two ports, one for MOBY and the other for WSRF, both of them using the same endpoint. The namespaces have been modified for the communication operations (SOAP, WSRF, and MOBY). Perl/MOBY/Async/* The methods have been modified to use RPC/encoded for both input and output. They accept namespaces from new asynchronous WSDL. Date: 2007-07-18 Developers: Jose Maria Fernandez (jmfernandez at cnio.es), Jose Manuel Rodriguez (jmrodriguez at cnio.es) - INB GN2 (CNIO, Spain). moby-live/Perl Makefile.PL,1.25,1.26 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/Makefile.PL,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- /home/repository/moby/moby-live/Perl/Makefile.PL 2007/02/07 01:21:24 1.25 +++ /home/repository/moby/moby-live/Perl/Makefile.PL 2007/07/18 10:47:24 1.26 @@ -153,6 +153,7 @@ # Database stuff required only for local registry, but notify user if missing anyway. 'DBI' => 0.01, 'DBD::mysql' => 0.01, + # 'WSRF::Lite' => '0.8.2.1', but it is not declared in the proper way there 'WSRF::Lite' => '', 'Test::Simple' => 0.44, 'XML::DOM' => '', From jmrc at dev.open-bio.org Wed Jul 18 10:47:35 2007 From: jmrc at dev.open-bio.org (José Manuel Rodríguez Carrasco) Date: Wed, 18 Jul 2007 10:47:35 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181047.l6IAlOlA028409@dev.open-bio.org> jmrc Wed Jul 18 06:47:24 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv28328/Perl/MOBY Modified Files: Central.pm Log Message: Description: Perl/MOBY/Makefile.PL We try to add WSRF::Lite version (0.8.2.1) but it is not declared in the proper way there. Perl/MOBY/Central.pm The WSDL template has been remade for asynchronous services. In the last version, it had a mix of RPC/encoded and document/literal in the only binding it had. The solution has been distributing the operations on two disjunctive port types and bindings, one for RPC/encoded operations and the other for document/literal operations. In that way, the service has two ports, one for MOBY and the other for WSRF, both of them using the same endpoint. The namespaces have been modified for the communication operations (SOAP, WSRF, and MOBY). Perl/MOBY/Async/* The methods have been modified to use RPC/encoded for both input and output. They accept namespaces from new asynchronous WSDL. Date: 2007-07-18 Developers: Jose Maria Fernandez (jmfernandez at cnio.es), Jose Manuel Rodriguez (jmrodriguez at cnio.es) - INB GN2 (CNIO, Spain). moby-live/Perl/MOBY Central.pm,1.284,1.285 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.284 retrieving revision 1.285 diff -u -r1.284 -r1.285 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/06/14 13:44:52 1.284 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/07/18 10:47:24 1.285 @@ -4116,169 +4116,201 @@ $WSDL_ASYNC_TEMPLATE = < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + - - + + - - + + - - + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + END From jmrc at dev.open-bio.org Wed Jul 18 10:47:44 2007 From: jmrc at dev.open-bio.org (José Manuel Rodríguez Carrasco) Date: Wed, 18 Jul 2007 10:47:44 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200707181047.l6IAlPao028443@dev.open-bio.org> jmrc Wed Jul 18 06:47:24 EDT 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Async In directory dev.open-bio.org:/tmp/cvs-serv28328/Perl/MOBY/Async Modified Files: LSAE.pm Service.pm SimpleServer.pm WSRF.pm Log Message: Description: Perl/MOBY/Makefile.PL We try to add WSRF::Lite version (0.8.2.1) but it is not declared in the proper way there. Perl/MOBY/Central.pm The WSDL template has been remade for asynchronous services. In the last version, it had a mix of RPC/encoded and document/literal in the only binding it had. The solution has been distributing the operations on two disjunctive port types and bindings, one for RPC/encoded operations and the other for document/literal operations. In that way, the service has two ports, one for MOBY and the other for WSRF, both of them using the same endpoint. The namespaces have been modified for the communication operations (SOAP, WSRF, and MOBY). Perl/MOBY/Async/* The methods have been modified to use RPC/encoded for both input and output. They accept namespaces from new asynchronous WSDL. Date: 2007-07-18 Developers: Jose Maria Fernandez (jmfernandez at cnio.es), Jose Manuel Rodriguez (jmrodriguez at cnio.es) - INB GN2 (CNIO, Spain). moby-live/Perl/MOBY/Async LSAE.pm,1.3,1.4 Service.pm,1.7,1.8 SimpleServer.pm,1.3,1.4 WSRF.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/LSAE.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/Async/LSAE.pm 2007/04/02 12:13:32 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/LSAE.pm 2007/07/18 10:47:24 1.4 @@ -6,8 +6,14 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). =head1 DESCRIPTION @@ -277,11 +283,11 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @heartbeat_progress = ($lsae->getChildrenByTagName('heartbeat_progress'), $lsae->getChildrenByTagName('lsae:heartbeat_progress')); - my @percent_progress = ($lsae->getChildrenByTagName('percent_progress'), $lsae->getChildrenByTagName('lsae:percent_progress')); - my @state_changed = ($lsae->getChildrenByTagName('state_changed'), $lsae->getChildrenByTagName('lsae:state_changed')); - my @step_progress = ($lsae->getChildrenByTagName('step_progress'), $lsae->getChildrenByTagName('lsae:step_progress')); - my @time_progress = ($lsae->getChildrenByTagName('time_progress'), $lsae->getChildrenByTagName('lsae:time_progress')); + my @heartbeat_progress = ($lsae->getChildrenByTagName('heartbeat_progress')); + my @percent_progress = ($lsae->getChildrenByTagName('percent_progress')); + my @state_changed = ($lsae->getChildrenByTagName('state_changed')); + my @step_progress = ($lsae->getChildrenByTagName('step_progress')); + my @time_progress = ($lsae->getChildrenByTagName('time_progress')); if (scalar(@heartbeat_progress)) { $self->{type} = MOBY::Async::LSAE::LSAE_HEARTBEAT_PROGRESS_EVENT; } elsif (scalar(@percent_progress)) { @@ -307,7 +313,7 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - $self->{id} = $lsae->getAttribute('id') || $lsae->getAttribute('moby:id'); + $self->{id} = $lsae->getAttribute('id') || $lsae->getAttributeNS($WSRF::Constants::MOBY, 'id'); } return $self->{id}; } @@ -320,7 +326,7 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - $self->{timestamp} = $lsae->getAttribute('timestamp') || $lsae->getAttribute('moby:timestamp'); + $self->{timestamp} = $lsae->getAttribute('timestamp') || $lsae->getAttributeNS($WSRF::Constants::MOBY, 'timestamp'); } return $self->{timestamp}; } @@ -333,7 +339,7 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('message'), $lsae->getChildrenByTagName('lsae:message')); + my @message = ($lsae->getChildrenByTagName('message')); my $message = shift(@message); $self->{message} = $message->getFirstChild->nodeValue if ($message); } @@ -350,9 +356,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('percent_progress'), $lsae->getChildrenByTagName('lsae:percent_progress')); + my @message = ($lsae->getChildrenByTagName('percent_progress')); my $message = shift(@message); - $self->{percentage} = $message->getAttribute('percentage') || $message->getAttribute('moby:percentage'); + $self->{percentage} = $message->getAttribute('percentage'); } } return $self->{percentage}; @@ -368,9 +374,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('state_changed'), $lsae->getChildrenByTagName('lsae:state_changed')); + my @message = ($lsae->getChildrenByTagName('state_changed')); my $message = shift(@message); - $self->{previous_state} = $message->getAttribute('previous_state') || $message->getAttribute('moby:previous_state'); + $self->{previous_state} = $message->getAttribute('previous_state'); } } return $self->{previous_state}; @@ -386,9 +392,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('state_changed'), $lsae->getChildrenByTagName('lsae:state_changed')); + my @message = ($lsae->getChildrenByTagName('state_changed')); my $message = shift(@message); - $self->{new_state} = $message->getAttribute('new_state') || $message->getAttribute('moby:new_state'); + $self->{new_state} = $message->getAttribute('new_state'); } } return $self->{new_state}; @@ -404,9 +410,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('step_progress'), $lsae->getChildrenByTagName('lsae:step_progress')); + my @message = ($lsae->getChildrenByTagName('step_progress')); my $message = shift(@message); - $self->{total_steps} = $message->getAttribute('total_steps') || $message->getAttribute('moby:total_steps'); + $self->{total_steps} = $message->getAttribute('total_steps'); } } return $self->{total_steps}; @@ -422,9 +428,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('step_progress'), $lsae->getChildrenByTagName('lsae:step_progress')); + my @message = ($lsae->getChildrenByTagName('step_progress')); my $message = shift(@message); - $self->{steps_completed} = $message->getAttribute('steps_completed') || $message->getAttribute('moby:steps_completed'); + $self->{steps_completed} = $message->getAttribute('steps_completed'); } } return $self->{steps_completed}; @@ -440,9 +446,9 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_string($self->{XML}); my $lsae = $doc->getDocumentElement(); - my @message = ($lsae->getChildrenByTagName('time_progress'), $lsae->getChildrenByTagName('lsae:time_progress')); + my @message = ($lsae->getChildrenByTagName('time_progress')); my $message = shift(@message); - $self->{remaining} = $message->getAttribute('remaining') || $message->getAttribute('moby:remaining'); + $self->{remaining} = $message->getAttribute('remaining'); } } return $self->{remaining}; @@ -464,7 +470,7 @@ my $id = " id=\"".$self->{id}."\"" if defined $self->{id}; my $timestamp = " timestamp=\"".$self->{timestamp}."\"" if defined $self->{timestamp}; - my $header = ""; + my $header = ""; my $footer = ""; my $message = "".$self->{message}."" if defined $self->{message}; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm 2007/04/02 12:13:32 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/Service.pm 2007/07/18 10:47:24 1.8 @@ -6,8 +6,14 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). =head1 DESCRIPTION @@ -225,7 +231,7 @@ } my $version = $self->{smessageVersion}; $data = " - + $data @@ -240,19 +246,19 @@ die "ERROR: ".$ans->faultstring if ($ans->fault); # Get address from the returned Endpoint Reference - my $address = $ans->match("//Body//{$WSRF::Constants::WSA}Address") ? - $ans->valueof("//Body//{$WSRF::Constants::WSA}Address") : + my $address = $ans->match("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") ? + $ans->valueof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") : die "ERROR: no EndpointReference returned"; die "ERROR: no address into returned EndpointReference" unless ($address); # Get resource identifier from the returned Endpoint Reference my $identifier; - if ($ans->dataof('//Body//ReferenceParameters/*')) { - foreach my $a ($ans->dataof('//Body//ReferenceParameters/*')) { + if ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { + foreach my $a ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { my $name = $a->name(); my $uri = $a->uri(); my $value = $a->value(); - if ($name eq "ServiceInvocationId") { + if ($name eq "ServiceInvocationId" && $uri eq $WSRF::Constants::MOBY) { $identifier = $value; last; } @@ -263,7 +269,7 @@ # Compose the Endpoint Reference my $EPR = WSRF::WS_Address->new(); $EPR->Address($address); - $EPR->ReferenceParameters(''.$identifier.''); + $EPR->ReferenceParameters(''.$identifier.''); print XML::LibXML->new->parse_string($EPR->XML)->getDocumentElement()->toString."\n\n" unless ($self->{silent}); @@ -358,7 +364,7 @@ } my $version = $self->{smessageVersion}; $data = " - + $data @@ -373,19 +379,19 @@ die "ERROR: ".$ans->faultstring if ($ans->fault); # Get address from the returned Endpoint Reference - my $address = $ans->match("//Body//{$WSRF::Constants::WSA}Address") ? - $ans->valueof("//Body//{$WSRF::Constants::WSA}Address") : + my $address = $ans->match("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") ? + $ans->valueof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}Address") : die "ERROR: no EndpointReference returned"; die "ERROR: no address into returned EndpointReference" unless ($address); # Get resource identifier from the returned Endpoint Reference my $identifier; - if ($ans->dataof('//Body//ReferenceParameters/*')) { - foreach my $a ($ans->dataof('//Body//ReferenceParameters/*')) { + if ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { + foreach my $a ($ans->dataof("//{$SOAP::Constants::NS_ENV}Body//{$WSRF::Constants::WSA}ReferenceParameters/*")) { my $name = $a->name(); my $uri = $a->uri(); my $value = $a->value(); - if ($name eq "ServiceInvocationId") { + if ($name eq "ServiceInvocationId" && $uri eq $WSRF::Constants::MOBY) { $identifier = $value; last; } @@ -396,7 +402,7 @@ # Compose the Endpoint Reference my $EPR = WSRF::WS_Address->new(); $EPR->Address($address); - $EPR->ReferenceParameters(''.$identifier.''); + $EPR->ReferenceParameters(''.$identifier.''); print XML::LibXML->new->parse_string($EPR->XML)->getDocumentElement()->toString."\n\n" unless ($self->{silent}); @@ -502,7 +508,7 @@ sub _getServiceEndpoint { my ($wsdl) = @_; - $wsdl =~ /location\s*=\s*["|'](.+)["|']/; + $wsdl =~ /address location\s*=\s*["|'](.+)["|']/; my $serviceEndpoint = $1; return $serviceEndpoint; @@ -609,19 +615,19 @@ my $moby = $doc->getDocumentElement(); # Get authority - my @mobyContents = ($moby->getChildrenByTagName('mobyContent'), $moby->getChildrenByTagName('moby:mobyContent')); + my @mobyContents = ($moby->getChildrenByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS, 'mobyContent')); my $mobyContent = shift(@mobyContents); - my $authority = $mobyContent->getAttribute('authority') || $mobyContent->getAttribute('moby:authority'); + my $authority = $mobyContent->getAttribute('authority') || $mobyContent->getAttributeNS($WSRF::Constants::MOBY_MESSAGE_NS, 'authority'); push(@authorities, $authority); # Get exceptions - my @mobyException = ($moby->getElementsByTagName('mobyException'), $moby->getElementsByTagName('moby:mobyException')); + my @mobyException = ($moby->getElementsByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS, 'mobyException')); foreach my $mobyException (@mobyException) { push(@exceptions, $mobyException->toString()); } # Get queries - my @mobyData = ($moby->getElementsByTagName('mobyData'), $moby->getElementsByTagName('moby:mobyData')); + my @mobyData = ($moby->getElementsByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS, 'mobyData')); foreach my $mobyData (@mobyData) { push(@queries, $mobyData->toString()); } @@ -629,7 +635,7 @@ my $moby; $moby = responseHeader(shift(@authorities)); - $moby .= "".join("", @exceptions)."" if (scalar(@exceptions)); + $moby .= "".join("", @exceptions)."" if (scalar(@exceptions)); $moby .= join("", @queries) if (scalar(@queries)); $moby .= responseFooter(); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm 2007/04/02 12:13:32 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/SimpleServer.pm 2007/07/18 10:47:24 1.4 @@ -6,8 +6,15 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). + =head1 DESCRIPTION @@ -108,14 +115,18 @@ # Create an EndpointReference for the resource my $EPR = WSRF::WS_Address->new(); $EPR->Address("http://".$ENV{SERVER_NAME}.$ENV{SCRIPT_NAME}); - $EPR->ReferenceParameters(''.$ENV{ID}.''); + $EPR->ReferenceParameters(''.$ENV{ID}.''); $EPR = XML::LibXML->new->parse_string($EPR->XML)->getDocumentElement->toString; # Write the properties to a file WSRF::File::toFile($ID); # Return the EndpointReference - return WSRF::Header::header($envelope), SOAP::Data->value($EPR)->type('xml'); + return WSRF::Header::header($envelope), SOAP::Data->uri($WSRF::Constants::MOBY) + ->name('body' => \SOAP::Data->value( + SOAP::Data->type('xml'=>$EPR) + ) + ); }; #=============================================================================== @@ -142,14 +153,14 @@ my $moby = $doc->getDocumentElement(); # Get authority - my @mobyContents = ($moby->getChildrenByTagName('mobyContent'), $moby->getChildrenByTagName('moby:mobyContent')); + my @mobyContents = ($moby->getChildrenByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS,'mobyContent')); my $mobyContent = shift(@mobyContents); - my $auth = $mobyContent->getAttribute('authority') || $mobyContent->getAttribute('moby:authority'); + my $auth = $mobyContent->getAttribute('authority') || $mobyContent->getAttributeNS($WSRF::Constants::MOBY_MESSAGE_NS,'authority'); # Get mobyData and iterate over them in order to run the service for each one - my @mobyData = ($moby->getElementsByTagName('mobyData'), $moby->getElementsByTagName('moby:mobyData')); + my @mobyData = ($moby->getElementsByTagNameNS($WSRF::Constants::MOBY_MESSAGE_NS,'mobyData')); foreach my $mobyData (@mobyData) { - my $queryID = $mobyData->getAttribute('queryID') || $mobyData->getAttribute('moby:queryID'); + my $queryID = $mobyData->getAttribute('queryID') || $mobyData->getAttributeNS($WSRF::Constants::MOBY_MESSAGE_NS,'queryID'); my $property_pid = "pid_$queryID"; my $property_input = "input_$queryID"; my $property_status = "status_$queryID"; @@ -183,7 +194,7 @@ # Result my $result; $result = responseHeader($ENV{AUTHURI}); - $result .= ""; + $result .= ""; $result .= "701"; $result .= "Unable to submit job."; $result .= ""; @@ -264,9 +275,25 @@ my $result; eval { my $xml = $func->($class, $input); - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_string($xml->value); - $result = $doc->getDocumentElement->toString; + if(UNIVERSAL::isa($xml,'XML::LibXML::Node')) { + if(UNIVERSAL::isa($xml,'XML::LibXML::Document')) { + $result=$xml->getDocumentElement()->toString(); + } else { + $result=$xml->toString(); + } + } else { + my $parser = XML::LibXML->new(); + my $toparse; + if(ref(\$xml) eq 'SCALAR') { + $toparse=$xml; + } elsif(UNIVERSAL::isa($xml,'SOAP::Data')) { + $toparse=$xml->value(); + } else { + die "FATAL ERROR: Unable to handle result type ".ref($xml); + } + my $doc = $parser->parse_string($toparse); + $result = $doc->getDocumentElement()->toString(); + } }; # Check if there has been errors during service execution @@ -294,7 +321,7 @@ # Result $result = responseHeader($ENV{AUTHURI}); - $result .= ""; + $result .= ""; $result .= "701"; $result .= "Error while executing job."; $result .= ""; @@ -304,7 +331,7 @@ } # New properties values - my $lock = WSRF::MobyFile->new($envelope); + $lock = WSRF::MobyFile->new($envelope); $WSRF::WSRP::Private{$property_pid} = ''; $WSRF::WSRP::ResourceProperties{$property_status} = $status->XML(); $WSRF::WSRP::ResourceProperties{$property_result} = $result; @@ -317,7 +344,7 @@ } # Compose response using the status properties - my $lock = WSRF::MobyFile->new($envelope); + $lock = WSRF::MobyFile->new($envelope); my $ans = ''; foreach my $queryID (@queryIDs) { my $property_status = "status_$queryID"; @@ -333,7 +360,11 @@ $lock->toFile(); # Return status properties - return WSRF::Header::header($envelope), SOAP::Data->value($ans)->type('xml'); +# return WSRF::Header::header($envelope), SOAP::Data->uri($WSRF::Constants::MOBY) +# ->name('body' => \SOAP::Data->value( +# SOAP::Data->type('xml'=>$ans) +# )); + return WSRF::Header::header($envelope), SOAP::Data->type('xml'=>$ans); }; #=============================================================================== @@ -372,7 +403,7 @@ } $ans .= responseHeader($ENV{AUTHURI}); - $ans .= "$exception"; + $ans .= "$exception"; $ans .= $response; $ans .= responseFooter(); $ans = SOAP::Data->value($ans)->type('string'); @@ -407,7 +438,7 @@ my $ans; $ans .= responseHeader($ENV{AUTHURI}); - $ans .= "$exception"; + $ans .= "$exception"; $ans .= $response; $ans .= responseFooter(); @@ -421,6 +452,11 @@ # sub async { my $wsa = $async_create->(@_); + # The specification says that async always work + # so any error related to job creation must + # be got using poll. + # That's the reason why we are ignoring the returned + # value from $async_submit $async_submit->(@_); return $wsa; } @@ -433,7 +469,7 @@ sub Destroy { my ($class, $envelope) = ($_[0], $_[$#_]); - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); $lock->toFile(); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Async/WSRF.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/Async/WSRF.pm 2007/04/02 12:13:32 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/Async/WSRF.pm 2007/07/18 10:47:24 1.3 @@ -6,8 +6,14 @@ =head1 AUTHORS +Former developer Enrique de Andres Saiz (enrique.deandres at pcm.uam.es) - -INB GNHC-1 (Madrid Science Park, Spain). +INB GNHC-1 (Madrid Science Park, Spain) (2006-2007). + +Maintainers +Jose Maria Fernandez (jmfernandez at cnio.es), +Jose Manuel Rodriguez (jmrodriguez at cnio.es) - +INB GN2 (CNIO, Spain). =head1 DESCRIPTION @@ -29,12 +35,13 @@ $WSRF::Constants::Data = '/tmp/moby_'; $WSRF::Constants::MOBY = 'http://biomoby.org/'; +$WSRF::Constants::MOBY_MESSAGE_NS = 'http://www.biomoby.org/moby'; $WSRF::Constants::WSA = 'http://www.w3.org/2005/08/addressing'; $WSRF::Constants::WSRP = 'http://docs.oasis-open.org/wsrf/rp-2'; $WSRF::Constants::WSRL = 'http://docs.oasis-open.org/wsrf/rl-2'; $WSRF::Constants::WSSG = 'http://docs.oasis-open.org/wsrf/sg-2'; $WSRF::Constants::WSBF = 'http://docs.oasis-open.org/wsrf/bf-2'; -$WSRF::Constants::WSA_ANON = 'http://www.w3.org/2005/03/addressing/role/anonymous'; +$WSRF::Constants::WSA_ANON = 'http://www.w3.org/2005/08/addressing/anonymous'; #=============================================================================== # WSRF::Serializer @@ -200,11 +207,11 @@ my $self = shift @_; my $envelope = pop @_; - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); $lock->toFile(); - my $search = $envelope->valueof('//GetResourceProperty/'); + my $search = $envelope->valueof("//{$WSRF::Constants::WSRP}GetResourceProperty/"); WSRF::BaseFaults::die_with_fault( $envelope, ( BaseFault => "InvalidResourcePropertyQNameFault", Description => "Property $search does not exist" @@ -220,12 +227,12 @@ my $self = shift @_; my $envelope = pop @_; - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); $lock->toFile(); my @notfound; - foreach my $search ($envelope->valueof('//ResourceProperty/')) { + foreach my $search ($envelope->valueof("//{$WSRF::Constants::WSRP}ResourceProperty/")) { push(@notfound, $search) unless (defined($WSRF::WSRP::ResourceProperties{$search})); } WSRF::BaseFaults::die_with_fault( $envelope, ( @@ -253,7 +260,7 @@ use vars qw(@ISA); @ISA = qw(WSRF::FileBasedMobyResourceProperties); -# Add reource property TerminationTime - initalise to nothing (infinity). +# Add resource property TerminationTime - initalise to nothing (infinity). $WSRF::WSRP::ResourceProperties{'TerminationTime'} = ''; $WSRF::WSRP::PropertyNamespaceMap->{TerminationTime}{prefix} = "wsrl"; $WSRF::WSRP::Nillable{TerminationTime} = 1; @@ -273,7 +280,7 @@ sub Destroy { my $self = shift @_; my $envelope = pop @_; - $ENV{ID} = $envelope->valueof("/Envelope/Header/ServiceInvocationId"); + $ENV{ID} = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::MOBY}ServiceInvocationId"); my $lock = WSRF::MobyFile->new($envelope); my $file = $WSRF::Constants::Data.$lock->ID(); unlink $file or WSRF::BaseFaults::die_with_fault( $envelope, ( @@ -390,8 +397,8 @@ if (defined($args{From})) { $myHeader .= "".$args{From}.""; } else { - if ( $envelope->match("/Envelope/Header/{$WSRF::Constants::WSA}To") ) { - my $from = $envelope->valueof("/Envelope/Header/{$WSRF::Constants::WSA}To"); + if ( $envelope->match("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::WSA}To") ) { + my $from = $envelope->valueof("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Header/{$WSRF::Constants::WSA}To"); $myHeader .= "$from"; } } @@ -407,7 +414,7 @@ if (defined($args{Action})) { $myHeader .= "".$args{Action}.""; } else { - my $data = $envelope->match('/Envelope/Body/[1]')->dataof; + my $data = $envelope->match("/{$SOAP::Constants::NS_ENV}Envelope/{$SOAP::Constants::NS_ENV}Body/[1]")->dataof; my $method = $data->name; my $uri = $data->uri; $myHeader .= "".$uri."/".$method."Response"; @@ -488,7 +495,7 @@ } foreach my $propertyPrefix (@{$WSRF::WSRP::MobyPropertiesPrefixes}) { $WSRF::WSRP::ResourceProperties{$propertyPrefix.'_'.$queryID} = $WSRF::WSRP::ResourceProperties{$propertyPrefix.'_'.$queryID} || ''; - $WSRF::WSRP::PropertyNamespaceMap->{$propertyPrefix.'_'.$queryID}{prefix} = 'moby'; + $WSRF::WSRP::PropertyNamespaceMap->{$propertyPrefix.'_'.$queryID}{prefix} = 'mobyws'; $WSRF::WSRP::PropertyNamespaceMap->{$propertyPrefix.'_'.$queryID}{namespace} = $WSRF::Constants::MOBY; $WSRF::WSRP::NotDeletable{$propertyPrefix.'_'.$queryID} = 1; $WSRF::WSRP::NotModifiable{$propertyPrefix.'_'.$queryID} = 1;