From kawas at dev.open-bio.org Wed Jan 17 14:58:45 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 17 Jan 2007 14:58:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701171958.l0HJwjrn004211@dev.open-bio.org> kawas Wed Jan 17 14:58:44 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv4176 Modified Files: Central.pm Log Message: updated the wsdl for async services. also fixed typo in _doAsyncWSDLReplacement. moby-live/Perl/MOBY Central.pm,1.268,1.269 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.268 retrieving revision 1.269 diff -u -r1.268 -r1.269 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/19 14:46:35 1.268 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/17 19:58:44 1.269 @@ -3210,7 +3210,7 @@ # we're just waiting for an example of an async # wsdl document from IMB my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; - my $wsdl = $WSDL_POST_TEMPLATE; + my $wsdl = $WSDL_ASYNC_TEMPLATE; $wsdl =~ s/^\n//gs; my $serviceName = $SI->servicename; my $AuthURI = $SI->authority_uri; @@ -4057,53 +4057,168 @@ $WSDL_ASYNC_TEMPLATE = < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + END From gordonp at dev.open-bio.org Fri Jan 19 13:32:36 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 19 Jan 2007 13:32:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701191832.l0JIWa2b010635@dev.open-bio.org> gordonp Fri Jan 19 13:32:36 EST 2007 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv10600/docs Modified Files: DataPackageInAnger.html Log Message: Fixed typos in DNASequence creation moby-live/Java/docs DataPackageInAnger.html,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2006/08/01 03:42:26 1.2 +++ /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2007/01/19 18:32:36 1.3 @@ -133,12 +133,12 @@ MobyDataComposite dnaSeqObj = new MobyDataComposite(dnaType, //type giNS, // namespace "123456", //id - "Sequence", "ATG", //begin (articleName, value) pairs + "SequenceString", "ATG", //begin (articleName, value) pairs "Length", "3"); Note that the constructor will automatically turn the value argument into a java.lang.String if it isn't already, then call the MobyDataObject.createInstanceFromString shown earlier with the - datatype specified in the ontology (moby:String for Sequence and moby:Integer for Length). + datatype specified in the ontology (moby:String for SequenceString and moby:Integer for Length).

If the value argument was already a MobyDataObject this process is avoided, @@ -148,7 +148,7 @@

 MobyDataString seqString = new MobyDataString("ATG");
 MobyDataComposite dnaSeqObj = new MobyDataComposite(dnaType, giNS, "123456", 
-                                                    "Sequence", seqString,
+                                                    "SequenceString", seqString,
                                                     "Length", "3");
 

From kawas at dev.open-bio.org Mon Jan 22 15:56:35 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 22 Jan 2007 15:56:35 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701222056.l0MKuZmS023061@dev.open-bio.org> kawas Mon Jan 22 15:56:34 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory dev.open-bio.org:/tmp/cvs-serv23025/Adaptor/moby/queryapi Modified Files: mysql.pm Log Message: bug fix for bug pointed out (and coded) by paul moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.79,1.80 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2006/05/31 21:12:19 1.79 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/22 20:56:34 1.80 @@ -1209,7 +1209,7 @@ my $ancestor_string = $args{'ancestor_string'}; my $namespaceURIs = $args{'namespaceURIs'}; - my $query ="select service_instance_id, namespace_type_uris from simple_$inout where object_type_uri in ($ancestor_string) and service_instance_id IS NOT NULL " + my $query ="select service_instance_id, namespace_type_uris from simple_$inout where object_type_uri in ($ancestor_string) and collection_input_id IS NULL " ; # if service_instance_id is null then it must be a collection input. my $nsquery; foreach my $ns ( @{$namespaceURIs} ) { # namespaces are already URI's From mwilkinson at dev.open-bio.org Mon Jan 22 16:19:34 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 22 Jan 2007 16:19:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701222119.l0MLJYuh023161@dev.open-bio.org> mwilkinson Mon Jan 22 16:19:34 EST 2007 Update of /home/repository/moby/moby-live/Docs/ProjectDocs In directory dev.open-bio.org:/tmp/cvs-serv23142/ProjectDocs Modified Files: index.html Log Message: ProjectDocs/index.html moby-live/Docs/ProjectDocs index.html,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/ProjectDocs/index.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Docs/ProjectDocs/index.html 2006/03/07 11:52:50 1.6 +++ /home/repository/moby/moby-live/Docs/ProjectDocs/index.html 2007/01/22 21:19:34 1.7 @@ -1,43 +1,43 @@ -

MOBY Project General Documentation

- -
-
jMoby documentation - -
jMoby contains libraries for Java developers, and it -also contains ready-to-use clients for any Biomoby users, allowing -access to Biomoby registries and to Biomoby services) - -
-

- -

Language Specific Documents

-

-
 

- -

FAQ's

-


- -

Catalogue of Registries

- - - - - - - - - - - - - - - - -
LocationEndpointPublic?DescriptionPolicy
iCAPTURE CentreEndpoint: http://mobycentral.icapture.ubc.ca/MOBY05/mobycentral.pl -
URI: http://mobycentral.icapture.ubc.ca/MOBY/Central
YESA curated public registry hosted at the iCAPTURE Centre, VancouverPolicy
IRRI PhilippinesEndpoint: http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl
- URI: http://cropwiki.irri.org/MOBY/Central
YESThe MOBY registry at the International Rice Research Institute -(IRRI) is intended mostly for Generation Challenge Program (GCP) -developers. It allows the registration of experimental moby entities -within GCP.Policy
- +

MOBY Project General Documentation

+ +
+
jMoby documentation + +
jMoby contains libraries for Java developers, and it +also contains ready-to-use clients for any Biomoby users, allowing +access to Biomoby registries and to Biomoby services) + +
+

+ +

Language Specific Documents

+

+
 

+ +

FAQ's

+


+ +

Catalogue of Registries

+ + + + + + + + + + + + + + + + +
LocationEndpointPublic?DescriptionPolicy
iCAPTURE CentreEndpoint: http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl +
URI: http://mobycentral.icapture.ubc.ca/MOBY/Central
YESA curated public registry hosted at the iCAPTURE Centre, VancouverPolicy
IRRI PhilippinesEndpoint: http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl
+ URI: http://cropwiki.irri.org/MOBY/Central
YESThe MOBY registry at the International Rice Research Institute +(IRRI) is intended mostly for Generation Challenge Program (GCP) +developers. It allows the registration of experimental moby entities +within GCP.Policy
+ From gordonp at dev.open-bio.org Tue Jan 23 14:36:26 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 23 Jan 2007 14:36:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701231936.l0NJaQAX025804@dev.open-bio.org> gordonp Tue Jan 23 14:36:25 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv25769/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java Log Message: Made DOM-built composites handle HAS children nicely moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 23:15:58 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/01/23 19:36:25 1.11 @@ -35,8 +35,6 @@ this(MobyDataType.getDataType(element.getLocalName()), getName(element), getNamespace(element), getId(element)); // Decompose the children - ConcurrentHashMap children = new ConcurrentHashMap(); - //HashMap children = new HashMap(); org.w3c.dom.NodeList substructures = MobyPrefixResolver.getChildElements(element, "*"); //wildcard int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ @@ -56,13 +54,10 @@ " does not have an article " + "name, which is required"); } - - // TODO, must deal with 1-to-many HAS relationship - children.put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); + + put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); } } - - putAll(children); } public MobyDataComposite(MobyDataType type, String name, MobyNamespace namespace, String id){ From mwilkinson at dev.open-bio.org Wed Jan 24 17:56:55 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 24 Jan 2007 17:56:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701242256.l0OMut6t029298@dev.open-bio.org> mwilkinson Wed Jan 24 17:56:55 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv29279/MOBY/Client Modified Files: Service.pm Log Message: silencing error on runnign test suite moby-live/Perl/MOBY/Client Service.pm,1.29,1.30 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 16:16:41 1.29 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2007/01/24 22:56:55 1.30 @@ -111,6 +111,8 @@ } } my $wsdl = $self->service; + return undef unless $wsdl; + if ($wsdl =~ //){ $self->category('post'); } @@ -125,7 +127,6 @@ # ________________________________________ $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug - return undef unless $wsdl; my $soap = SOAP::Lite->service( "data:,$wsdl" ); if ( $self->uri ) { $soap->uri( $self->uri ) } $self->serviceName( &_getServiceName( $soap ) ); From mwilkinson at dev.open-bio.org Wed Jan 24 17:56:55 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 24 Jan 2007 17:56:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701242256.l0OMutX8029316@dev.open-bio.org> mwilkinson Wed Jan 24 17:56:55 EST 2007 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv29279/t Modified Files: Client-Service.t Log Message: silencing error on runnign test suite moby-live/Perl/t Client-Service.t,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Service.t,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Perl/t/Client-Service.t 2005/11/22 20:05:00 1.8 +++ /home/repository/moby/moby-live/Perl/t/Client-Service.t 2007/01/24 22:56:55 1.9 @@ -62,7 +62,7 @@ my ($s, $err) = $C->findService( authURI => 'test.suite.com', name => 'myfirstservice' ); ok($s) or diag("Couldn't retrieve service details from MOBY Central"); -ok($$s[0]) or diag("no service instance found for getDragonLocusAlleles"); +ok($$s[0]) or diag("Just registered service, but not found on findService"); my $wsdl = $C->retrieveService($$s[0]); ok($wsdl =~ /WSDL/) or diag("retrieveService didn't return a WSDL file"); $service = MOBY::Client::Service->new (service => $wsdl); @@ -76,6 +76,6 @@ # Empty WSDL should cause 'undef' to be returned, rather than empty Service object. my $emptyWSDL = ""; is(MOBY::Client::Service->new ( service => $emptyWSDL), undef) - or diag("Expected new to return MOBY::Client::Service"); + or diag("Expected new to return undef when passed empty WSDL file"); From mwilkinson at dev.open-bio.org Thu Jan 25 11:38:58 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 11:38:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251638.l0PGcwt4031139@dev.open-bio.org> mwilkinson Thu Jan 25 11:38:58 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31120/MOBY/Client Modified Files: Central.pm Log Message: allow software using MOBY::Client::Central to declare its name as the User Agent such that we can keep track of it in the logs moby-live/Perl/MOBY/Client Central.pm,1.137,1.138 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.137 retrieving revision 1.138 diff -u -r1.137 -r1.138 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/14 17:57:06 1.137 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 16:38:58 1.138 @@ -90,7 +90,8 @@ MOBY_URI (default http://mobycentral.cbr.nrc.ca/MOBY/Central) MOBY_PROXY (no default) - Args : Registries - optional. + Args : user_agent - optional. The name of your software application + Registries - optional. - takes the form {$NAME1 => { URL => $URL, @@ -152,6 +153,8 @@ default_MOBY_type => [ 'soap', 'read/write' ], Registries => [ undef, 'read/write' ], multiple_registries => [ undef, 'read/write' ], + user_agent => [ "MOBY-Client-Central", 'read/write'], + # SWITCH TO THESE FOR A LOCAL MOBY CENTRAL REGISTRY #default_MOBY_server => ['http://localhost/cgi-bin/MOBY-Central.pl', 'read/write'], @@ -217,6 +220,7 @@ #print STDERR "executing CGI call\n"; use LWP::UserAgent; my $ua = LWP::UserAgent->new; + $ua->agent($self->user_agent); use CGI; $param =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg; my $paramstring = "?action=$method"; From mwilkinson at dev.open-bio.org Thu Jan 25 12:00:18 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:00:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251700.l0PH0Irp031233@dev.open-bio.org> mwilkinson Thu Jan 25 12:00:18 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31214/MOBY/Client Modified Files: Central.pm Log Message: allow software using MOBY::Client::Central to declare its name as the User Agent such that we can keep track of it in the logs moby-live/Perl/MOBY/Client Central.pm,1.138,1.139 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.138 retrieving revision 1.139 diff -u -r1.138 -r1.139 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 16:38:58 1.138 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 17:00:18 1.139 @@ -284,7 +284,7 @@ else { my @soapargs; if ($proxy) { - @soapargs = ( $url, proxy => [ 'http' => $proxy ] ); + @soapargs = ( $url, proxy => [ 'http' => $proxy ], user_agent => $self->user_agent, ); } else { @soapargs = ($url); From mwilkinson at dev.open-bio.org Thu Jan 25 12:12:14 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:12:14 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251712.l0PHCEq1031315@dev.open-bio.org> mwilkinson Thu Jan 25 12:12:14 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv31296/MOBY Modified Files: Central.pm Log Message: more changes for User Agent reporting moby-live/Perl/MOBY Central.pm,1.269,1.270 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.269 retrieving revision 1.270 diff -u -r1.269 -r1.270 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/17 19:58:44 1.269 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/25 17:12:14 1.270 @@ -36,6 +36,7 @@ #use RDF::Core::Constants qw(:xml :rdf :rdfs); use MOBY::MobyXMLConstants; my $debug = 0; +my %user_agent_args = (agent => "MOBY-Central-Perl"); if ($debug) { open( OUT, ">/tmp/CentralRegistryLogOut.txt" ) || die "cant open logfile\n"; @@ -1430,7 +1431,7 @@ sub _getServiceInstanceRDF { my ( %args ) = @_; - my $browser = LWP::UserAgent->new; + my $browser = LWP::UserAgent->new(%user_agent_args); my $conf = MOBY::Config->new(); return "" unless $conf->{mobycentral}->{rdf_generator}; my $url = URI->new( $conf->{mobycentral}->{rdf_generator} ); From mwilkinson at dev.open-bio.org Thu Jan 25 12:12:15 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:12:15 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251712.l0PHCFVO031335@dev.open-bio.org> mwilkinson Thu Jan 25 12:12:14 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31296/MOBY/Client Modified Files: OntologyServer.pm Log Message: more changes for User Agent reporting moby-live/Perl/MOBY/Client OntologyServer.pm,1.15,1.16 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2005/11/22 21:33:23 1.15 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:12:14 1.16 @@ -76,6 +76,8 @@ use vars qw($AUTOLOAD); use LWP::UserAgent; my $debug = 0; +my %user_agent_args = (agent => "MOBY-OntologyServer-Perl"); + { #Encapsulated class data @@ -208,7 +210,7 @@ sub getUserAgent { my ( $self, @args ) = @_; - my $ua = LWP::UserAgent->new; + my $ua = LWP::UserAgent->new(%user_agent_args); my $proxy = $ENV{MOBY_PROXY} if $ENV{MOBY_PROXY}; # first check the environment $proxy = $self->proxy From mwilkinson at dev.open-bio.org Thu Jan 25 12:15:13 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:15:13 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251715.l0PHFDRL031418@dev.open-bio.org> mwilkinson Thu Jan 25 12:15:13 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31399/MOBY/Client Modified Files: OntologyServer.pm Log Message: more changes for User Agent reporting moby-live/Perl/MOBY/Client OntologyServer.pm,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:12:14 1.16 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:15:13 1.17 @@ -76,7 +76,7 @@ use vars qw($AUTOLOAD); use LWP::UserAgent; my $debug = 0; -my %user_agent_args = (agent => "MOBY-OntologyServer-Perl"); +my $user_agent = "MOBY-OntologyServer-Perl"; { @@ -210,7 +210,8 @@ sub getUserAgent { my ( $self, @args ) = @_; - my $ua = LWP::UserAgent->new(%user_agent_args); + my $ua = LWP::UserAgent->new(); + $ua->agent($user_agent); my $proxy = $ENV{MOBY_PROXY} if $ENV{MOBY_PROXY}; # first check the environment $proxy = $self->proxy From kawas at dev.open-bio.org Fri Jan 26 16:50:00 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 16:50:00 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262150.l0QLo03f001752@dev.open-bio.org> kawas Fri Jan 26 16:49:59 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1715/Client Modified Files: Central.pm Log Message: user-agent update (tested on soaplite .69) moby-live/Perl/MOBY/Client Central.pm,1.139,1.140 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.139 retrieving revision 1.140 diff -u -r1.139 -r1.140 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 17:00:18 1.139 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 21:49:59 1.140 @@ -292,7 +292,7 @@ push @{ $self->Connections }, [ $name, $type, - SOAP::Lite->proxy(@soapargs)->uri($uri)->on_fault( + SOAP::Lite->proxy(@soapargs, agent=>$self->user_agent )->uri($uri)->on_fault( sub { my ( $soap, $res ) = @_; die ref $res @@ -339,7 +339,7 @@ [ $self->default_MOBY_servername, $self->default_MOBY_type, - SOAP::Lite->proxy(@soapargs)->uri( $self->default_MOBY_uri ) + SOAP::Lite->proxy(@soapargs, agent=>$self->user_agent )->uri( $self->default_MOBY_uri ) ->on_fault( sub { my ( $soap, $res ) = @_; From mwilkinson at dev.open-bio.org Fri Jan 26 18:32:32 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 26 Jan 2007 18:32:32 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262332.l0QNWWOb002193@dev.open-bio.org> mwilkinson Fri Jan 26 18:32:32 EST 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv2174 Modified Files: MobyCentralObjects.html Log Message: updating docs for async moby-live/Docs/MOBY-S_API MobyCentralObjects.html,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2006/12/08 15:15:05 1.8 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2007/01/26 23:32:32 1.9 @@ -201,7 +201,7 @@ Ontology_Term </serviceType> <authoritative>1</authoritative> - <Category>moby</Category> <!-- 'moby' or 'cgi' or 'soap' --> + <Category>moby</Category> <!-- 'moby' or 'moby-async' or 'post' --> <Description><![CDATA[free text description here]]></Description> <contactEmail>your at email.addy.here</contactEmail> <URL>http://service.endpoint.here/scriptname</URL> From mwilkinson at dev.open-bio.org Fri Jan 26 18:46:26 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 26 Jan 2007 18:46:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262346.l0QNkQla002253@dev.open-bio.org> mwilkinson Fri Jan 26 18:46:26 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv2234/MOBY/Client Modified Files: Central.pm Log Message: removing default 'moby' service category from findService call moby-live/Perl/MOBY/Client Central.pm,1.140,1.141 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.140 retrieving revision 1.141 diff -u -r1.140 -r1.141 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 21:49:59 1.140 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 23:46:26 1.141 @@ -978,7 +978,7 @@ my $authoritative = $a{'authoritative'} || 0; my $serviceType = $a{'serviceType'} || ""; my $authURI = $a{'authURI'} || ""; - my $category = $a{'category'} || "moby"; + my $category = $a{'category'} || ""; my $exObj = $a{'expandObjects'} || 0; my $exServ = $a{'expandServices'} || 0; my $kw = $a{'keywords'} || []; From mwilkinson at dev.open-bio.org Fri Jan 26 18:46:26 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 26 Jan 2007 18:46:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262346.l0QNkQTJ002273@dev.open-bio.org> mwilkinson Fri Jan 26 18:46:26 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv2234/MOBY Modified Files: Central.pm Log Message: removing default 'moby' service category from findService call moby-live/Perl/MOBY Central.pm,1.270,1.271 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.270 retrieving revision 1.271 diff -u -r1.270 -r1.271 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/25 17:12:14 1.270 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/26 23:46:26 1.271 @@ -2051,7 +2051,7 @@ ++$valid_service_ids{$_}; # increment that particular id's count by one } } - $findme{category} = 'moby' unless $findme{category}; + if ( $findme{category} ) { ++$criterion_count; $debug From kawas at dev.open-bio.org Fri Jan 26 19:14:55 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:14:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270014.l0R0EtNH002397@dev.open-bio.org> kawas Fri Jan 26 19:14:55 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv2362/Java/src/main/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.33,1.34 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/10/25 02:33:23 1.33 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2007/01/27 00:14:55 1.34 @@ -2,10 +2,7 @@ import java.io.BufferedReader; import java.io.ByteArrayOutputStream; -import java.io.FilterOutputStream; -import java.io.IOException; import java.io.InputStreamReader; -import java.io.OutputStream; import java.net.URL; import java.util.HashMap; import java.util.Map; @@ -34,7 +31,6 @@ import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.RDF; import com.ibm.lsid.LSID; -import com.ibm.lsid.LSIDException; import com.ibm.lsid.MalformedLSIDException; /* @@ -223,6 +219,7 @@ } // set up the query service service = new MobyService(serviceName); + service.setCategory(""); service.setAuthority(domain); // query for the service try { @@ -254,6 +251,7 @@ // set up the query service service = new MobyService(); service.setAuthority(domain); + service.setCategory(""); // query for the service try { services = central.findService(service); @@ -308,6 +306,7 @@ // set up the query service service = new MobyService(serviceName); service.setAuthority(domain); + service.setCategory(""); // query for the service try { services = central.findService(service); @@ -338,6 +337,7 @@ // set up the query service service = new MobyService(); service.setAuthority(domain); + service.setCategory(""); // query for the service try { services = central.findService(service); @@ -376,6 +376,7 @@ } // set up the query service service = new MobyService(""); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -454,6 +455,7 @@ } // set up the query service service = new MobyService(""); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -495,6 +497,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -537,6 +540,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -1018,6 +1022,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(uri); // query for the service try { @@ -1040,6 +1045,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(uri); // service.setLSID(lsid); // query for the service @@ -1068,6 +1074,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(uri); // query for the service try { @@ -1081,25 +1088,4 @@ } return ""; } - - /** - * - * Usage: ServiceInstanceRDF authorityURI [serviceName] - *

- * authorityURI: is the authortitys' domain to query - *

- * serviceName: optional argument that identifies a specific service - * instance - *

- * - * @throws LSIDException - */ - public final static void main(String[] args) throws Exception { - // log.info(findService("bioinfo.inibap.org","Get_TropGENE_Distance_Matrix", - // false)); - // log.info(findService("bioinfo.icapture.ubc.ca","MOBYSHoundGetGenBankGFF", - // false)); - log.info(findService("blah.blah.blah", "Echo_test", "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", "http://bioinfo.icapture.ubc.ca/MOBY/Central", false)); - // log.info(findService("", "", false)); - } } From kawas at dev.open-bio.org Fri Jan 26 19:16:04 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:16:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270016.l0R0G4Fp002444@dev.open-bio.org> kawas Fri Jan 26 19:16:04 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv2405/Java/src/main/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Main.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.30,1.31 Main.java,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/10/06 17:47:33 1.30 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2007/01/27 00:16:04 1.31 @@ -328,14 +328,18 @@ try { MobyService[] registryServices = new MobyService[] { new MobyService() }; // set the signature url to be the url + registryServices[0].setCategory(""); registryServices[0].setSignatureURL(url); registryServices = central.findService(registryServices[0]); + // FIXME search for async and post se + if (registryServices == null) throw new MobyException("Findservice call failed."); registryCount = registryServices.length; for (int i = 0; i < registryServices.length; i++) { foundServices.put(registryServices[i].getUniqueName(), registryServices[i]); } + } catch (MobyException e) { // Log.exception(this.getClass().getName(), "processServicesFromURL(String, Central)", e); @@ -393,6 +397,7 @@ Log.info("Unable to find a service in the registry that matches (" + rdfService.getUniqueName() + ")."); MobyService[] ms = new MobyService[] { new MobyService(rdfService.getName()) }; + ms[0].setCategory(""); ms[0].setAuthority(rdfService.getAuthority()); try { @@ -759,9 +764,12 @@ processCentralAdminCode(code); if (service.getEmailContact().trim().equals("")) { try { - MobyService[] services = central.findService(new MobyService(service.getName())); + MobyService __template__ = new MobyService(service.getName()); + __template__.setCategory(""); + MobyService[] services = central.findService(__template__); if (services == null || services.length < 1) { MobyService temp = new MobyService(); + temp.setCategory(""); temp.setAuthority(service.getAuthority()); services = central.findService(temp); if (services == null || services.length < 1) { @@ -794,9 +802,12 @@ } else { if (service.getEmailContact().trim().equals("")) { try { - MobyService[] services = central.findService(new MobyService(service.getName())); + MobyService __template__ = new MobyService(service.getName()); + __template__.setCategory(""); + MobyService[] services = central.findService(__template__); if (services == null || services.length < 1) { MobyService temp = new MobyService(); + temp.setCategory(""); temp.setAuthority(service.getAuthority()); services = central.findService(temp); if (services == null || services.length < 1) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2006/10/04 18:43:53 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2007/01/27 00:16:04 1.20 @@ -219,7 +219,10 @@ MobyService[] services = null; try { Log.info("Getting all services from the registry. Will take some time."); - services = central.findService(new MobyService()); + MobyService __template__ = new MobyService(); + __template__.setCategory(""); + services = central.findService(__template__); + __template__ = null; Log.info("Successfully retrieved all services from the registry."); } catch (MobyException e) { Log.exception("org.registry.rdfagent.verifier.Main", "processRegistry()", e.getCause()); From kawas at dev.open-bio.org Fri Jan 26 19:17:09 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:17:09 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270017.l0R0H936002520@dev.open-bio.org> kawas Fri Jan 26 19:17:09 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util In directory dev.open-bio.org:/tmp/cvs-serv2485/Java/src/main/org/biomoby/registry/rdfagent/util Modified Files: SignatureURLConnection.java Log Message: set the user agent for the agent moby-live/Java/src/main/org/biomoby/registry/rdfagent/util SignatureURLConnection.java,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/10/06 16:39:20 1.14 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2007/01/27 00:17:09 1.15 @@ -59,6 +59,7 @@ try { Log.info("Opening a connection to the url"); urlConnection = (HttpURLConnection) new URL(url).openConnection(); + urlConnection.setRequestProperty("User-Agent", "RDFAgent/1.0"); urlConnection.setDefaultUseCaches(false); urlConnection.setUseCaches(false); From kawas at dev.open-bio.org Fri Jan 26 19:20:45 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:20:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270020.l0R0KjrR002653@dev.open-bio.org> kawas Fri Jan 26 19:20:45 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities In directory dev.open-bio.org:/tmp/cvs-serv2618/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities Modified Files: ServiceTester.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities ServiceTester.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2006/10/25 19:32:54 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2007/01/27 00:20:45 1.10 @@ -62,7 +62,7 @@ public MobyService[] getServices() { MobyService[] services = null; MobyService template = new MobyService(); - + template.setCategory(""); try { Central central = new CentralImpl(url, uri); services = central.findService(template); @@ -340,6 +340,7 @@ // MOST likely a newly added service MobyService s = new MobyService(servicename); s.setAuthority(authority); + s.setCategory(""); try { Central central = new CentralImpl(url, uri); if (central.findService(s).length > 0) @@ -353,6 +354,7 @@ // MOST likely a newly added service MobyService s = new MobyService(servicename); s.setAuthority(authority); + s.setCategory(""); try { Central central = new CentralImpl(url, uri); if (central.findService(s).length > 0) From kawas at dev.open-bio.org Fri Jan 26 19:22:55 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:22:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270022.l0R0Mt9D002696@dev.open-bio.org> kawas Fri Jan 26 19:22:55 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities In directory dev.open-bio.org:/tmp/cvs-serv2661/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities Modified Files: ServiceTester.java Log Message: set the user agent for the pinger moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities ServiceTester.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2007/01/27 00:20:45 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2007/01/27 00:22:55 1.11 @@ -7,6 +7,7 @@ import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; @@ -17,6 +18,7 @@ import org.apache.axis.AxisFault; import org.apache.axis.client.Call; import org.apache.axis.client.Service; +import org.apache.axis.transport.http.HTTPConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.log4j.Logger; @@ -384,6 +386,11 @@ Service service = new Service(); call = (Call) service.createCall(); call.setTargetEndpointAddress(endpoint); + // set the agent + Hashtable t = new Hashtable(); + t.put(HTTPConstants.HEADER_USER_AGENT, "MobyPinger/1.0"); + call.setProperty(HTTPConstants.REQUEST_HEADERS, t); + // wait at most 2 minutes call.setTimeout(new Integer(1000 * 60 * 3)); From kawas at dev.open-bio.org Fri Jan 26 19:31:09 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:31:09 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270031.l0R0V9L8002985@dev.open-bio.org> kawas Fri Jan 26 19:31:08 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms In directory dev.open-bio.org:/tmp/cvs-serv2946/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms Modified Files: RDFGenerator.java LSIDComplete.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms RDFGenerator.java,1.5,1.6 LSIDComplete.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.java 2006/08/30 17:07:55 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.java 2007/01/27 00:31:08 1.6 @@ -20,8 +20,9 @@ * @author Eddie Kawas *

* Created for use by the Perl based moby central registry so that RDF - * documents for newly registered services can be generated. This servlet is most likely - * only called when a service has been registered. + * documents for newly registered services can be generated. This + * servlet is most likely only called when a service has been + * registered. *

* email me at edward.kawas at gmail.com */ @@ -34,18 +35,19 @@ final private String newline = System.getProperty("line.separator"); - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { String authority = filter(request.getParameter("auth")); String serviceName = filter(request.getParameter("name")); String endpoint = filter(request.getParameter("url")); String uri = filter(request.getParameter("uri")); - //System.out.println(endpoint + " " + authority + " " + uri + " " + serviceName); + // System.out.println(endpoint + " " + authority + " " + uri + " " + + // serviceName); // null endpoints or uri default to mobycentral endpoint = (endpoint == null) ? CentralImpl.DEFAULT_ENDPOINT : endpoint; uri = (uri == null) ? CentralImpl.DEFAULT_NAMESPACE : uri; - + if (serviceName == null || serviceName.equals("")) { // error routine here response.setContentType("text/html"); @@ -60,9 +62,9 @@ out.println("The service providers authority is missing"); return; } + response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", "attachment;filename=" - + "service.rdf"); + response.setHeader("Content-Disposition", "attachment;filename=" + "service.rdf"); PrintWriter out = response.getWriter(); out.print(ServiceInstanceRDF.findService(authority, serviceName, endpoint, uri, false)); return; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.java 2006/10/11 01:54:50 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.java 2007/01/27 00:31:08 1.3 @@ -11,9 +11,9 @@ import java.util.Iterator; import java.util.Map; import java.util.Properties; -import java.util.Timer; -import java.util.TimerTask; + +import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -21,10 +21,8 @@ import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.discovery.tools.DiscoverSingleton; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.biomoby.client.ui.graphical.servlet.utilities.ContextLoader; import org.biomoby.registry.properties.MobyProperties; /* @@ -50,26 +48,8 @@ private Map datas = Collections.synchronizedMap(new HashMap()); - public void init() throws ServletException { + public void init(ServletConfig conf) throws ServletException { super.init(); - - - ContextLoader cLoader = null; - try { - cLoader = (ContextLoader) DiscoverSingleton.find(Class - .forName((String) ContextLoader.class.getCanonicalName()), Class.forName( - (String) ContextLoader.class.getCanonicalName()).getName()); - log - .warn((cLoader == null ? "ContextLoader is null and is therefore not loaded. This is BAD!" - : "ContextLoader has loaded successfully.")); - } catch (Exception e) { - log.warn("ContextLoader is null and is therefore not loaded. This is BAD!" - + System.getProperty("line.separator") + e.getStackTrace()); - } - - log.debug("Initializing the Timer that will invoke the StatWriter"); - Timer timer = new Timer(); - timer.scheduleAtFixedRate(new StatWriter(this), new java.util.Date(), 1000 * 60 * 60); } // an array of properties objects created initialized once for more efficient running @@ -331,8 +311,10 @@ continue; BasicDataSource bds = (BasicDataSource) ds; log.info("NumActive connections to " + object + ": " + bds.getNumActive()); - log.info("NumIdle: connections to " + object + ": " + bds.getNumIdle()); + log.info("NumIdle: connections to " + object + ": " + bds.getNumIdle()); + shutdownDataSource(bds); } + map.clear(); } public void shutdownDataSource(DataSource ds) throws SQLException { @@ -340,22 +322,4 @@ bds.close(); ds = null; } - - private class StatWriter extends TimerTask { - private LSIDComplete lc = null; - - public StatWriter(LSIDComplete lc) { - this.lc = lc; - } - - public void run() { - log.debug("Attempting to invoke StatWriter"); - try { - printDataSourceStats(lc.datas); - } catch (SQLException e) { - log.error("Error invoking the StatWriter " + e.getLocalizedMessage()); - } - } - - } } \ No newline at end of file From kawas at dev.open-bio.org Fri Jan 26 19:32:30 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:32:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270032.l0R0WUe0003061@dev.open-bio.org> kawas Fri Jan 26 19:32:30 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv3026/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: MobyAuthority.java Log Message: include signatureURLs for services as a source for metadata moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority MobyAuthority.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/10/19 21:25:25 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2007/01/27 00:32:30 1.10 @@ -117,6 +117,7 @@ : System.getProperty("MOBY_URI"))); MobyService service = new MobyService(parts[1]); service.setAuthority(parts[0]); + service.setCategory(""); MobyService[] services = central.findService(service); if (services.length == 1) if (services[0].getSignatureURL() != null From kawas at dev.open-bio.org Fri Jan 26 19:34:07 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:34:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270034.l0R0Y7BI003140@dev.open-bio.org> kawas Fri Jan 26 19:34:06 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources In directory dev.open-bio.org:/tmp/cvs-serv3105/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources Modified Files: RESOURCE.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.24,1.25 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/10/16 17:23:16 1.24 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2007/01/27 00:34:06 1.25 @@ -389,7 +389,9 @@ // exists central = new CentralImpl(); } - services = central.findService(new MobyService("")); + MobyService __service__ = new MobyService(); + __service__.setCategory(""); + services = central.findService(__service__); } catch (MobyException e) { log.error("Exception thrown: " + e.getMessage()); } From mwilkinson at dev.open-bio.org Mon Jan 29 19:16:25 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:16:25 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300016.l0U0GP0x032532@dev.open-bio.org> mwilkinson Mon Jan 29 19:16:25 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv32513/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.271,1.272 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.271 retrieving revision 1.272 diff -u -r1.271 -r1.272 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/26 23:46:26 1.271 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:16:25 1.272 @@ -2193,6 +2193,17 @@ ++$valid_service_ids{$_}; } } + + unless ($criterion_count){ # in case all criterion are null, find everything + my $ids = _extract_ids($adaptor->query_service_instance(category => "%" )); + unless ( scalar @{$ids} ) { + return &_serviceListResponse( undef ); + } + foreach ( @{$ids} ) { + $debug && &_LOG("found service_instance_id $_\n"); + ++$valid_service_ids{$_}; # increment that particular id's count by one + } + } my @final; while ( my ( $id, $freq ) = each %valid_service_ids ) { $debug From mwilkinson at dev.open-bio.org Mon Jan 29 19:26:18 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:26:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300026.l0U0QIcB032610@dev.open-bio.org> mwilkinson Mon Jan 29 19:26:18 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory dev.open-bio.org:/tmp/cvs-serv32571/MOBY/Adaptor/moby/queryapi Modified Files: mysql.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.80,1.81 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/22 20:56:34 1.80 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/30 00:26:18 1.81 @@ -121,19 +121,19 @@ for my $key (keys %pair) { - if (defined $pair{$key}) - { - #added a check for servicename to support case sensitivity - if ($key eq "servicename") { - $condition .= $key . " LIKE binary ? "; - } else { - $condition .= $key . " = ? "; - } - push(@bindvalues, $pair{$key}); - } - else - { - $condition .= $key . " IS NULL " + if (defined $pair{$key}){ + #added a check for servicename to support case sensitivity + if ($key eq "servicename") { + $condition .= $key . " LIKE binary ? "; + push(@bindvalues, $pair{$key}); + } elsif ($pair{$key} eq "IS NOT NULL"){ + $condition .= $key . " IS NOT NULL "; + } else { + $condition .= $key . " = ? "; + push(@bindvalues, $pair{$key}); + } + } else{ + $condition .= $key . " IS NULL " } } } From mwilkinson at dev.open-bio.org Mon Jan 29 19:26:18 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:26:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300026.l0U0QIdR032590@dev.open-bio.org> mwilkinson Mon Jan 29 19:26:18 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv32571/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.272,1.273 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.272 retrieving revision 1.273 diff -u -r1.272 -r1.273 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:16:25 1.272 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:26:18 1.273 @@ -2195,7 +2195,7 @@ } unless ($criterion_count){ # in case all criterion are null, find everything - my $ids = _extract_ids($adaptor->query_service_instance(category => "%" )); + my $ids = _extract_ids($adaptor->query_service_instance(category => "IS NOT NULL" )); unless ( scalar @{$ids} ) { return &_serviceListResponse( undef ); } From mwilkinson at dev.open-bio.org Mon Jan 29 19:32:54 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:32:54 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300032.l0U0Ws1m032670@dev.open-bio.org> mwilkinson Mon Jan 29 19:32:54 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv32651/MOBY/Client Modified Files: Central.pm Log Message: remove default value of authoritative for MOBY::Client::Service moby-live/Perl/MOBY/Client Central.pm,1.141,1.142 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.141 retrieving revision 1.142 diff -u -r1.141 -r1.142 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 23:46:26 1.141 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/30 00:32:54 1.142 @@ -975,7 +975,7 @@ my $reg = ( $a{Registry} ) ? $a{Registry} : $self->default_MOBY_servername; my $id = $a{'serviceID'}; my $servicename = $a{'serviceName'} || ""; - my $authoritative = $a{'authoritative'} || 0; + my $authoritative = $a{'authoritative'} || ""; my $serviceType = $a{'serviceType'} || ""; my $authURI = $a{'authURI'} || ""; my $category = $a{'category'} || ""; From mwilkinson at dev.open-bio.org Mon Jan 29 19:41:30 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:41:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300041.l0U0fUo5032748@dev.open-bio.org> mwilkinson Mon Jan 29 19:41:29 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv32729/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.273,1.274 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.273 retrieving revision 1.274 diff -u -r1.273 -r1.274 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:26:18 1.273 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:41:29 1.274 @@ -2193,8 +2193,10 @@ ++$valid_service_ids{$_}; } } - +print STDERR "Criterion Count was $criterion_count\n"; unless ($criterion_count){ # in case all criterion are null, find everything + ++$criterion_count; # this is an AWFUL hack. We need to add a criterion in order for teh next while loop to be successful in finding each of these services. This is really really terrible, but it works until someone tries to "fix" something... + my $ids = _extract_ids($adaptor->query_service_instance(category => "IS NOT NULL" )); unless ( scalar @{$ids} ) { return &_serviceListResponse( undef ); From mwilkinson at dev.open-bio.org Mon Jan 29 19:42:45 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:42:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300042.l0U0gjUj000339@dev.open-bio.org> mwilkinson Mon Jan 29 19:42:45 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv320/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.274,1.275 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.274 retrieving revision 1.275 diff -u -r1.274 -r1.275 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:41:29 1.274 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:42:45 1.275 @@ -2193,7 +2193,6 @@ ++$valid_service_ids{$_}; } } -print STDERR "Criterion Count was $criterion_count\n"; unless ($criterion_count){ # in case all criterion are null, find everything ++$criterion_count; # this is an AWFUL hack. We need to add a criterion in order for teh next while loop to be successful in finding each of these services. This is really really terrible, but it works until someone tries to "fix" something... From d.haase at dev.open-bio.org Tue Jan 30 09:34:18 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:34:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301434.l0UEYIqv001634@dev.open-bio.org> d.haase Tue Jan 30 09:34:17 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv1599 Modified Files: Central.pm Log Message: Changed Relationships such that it can process both directions ('root' and 'leaves'). 'leaves' direction was not possible yet. moby-live/Perl/MOBY Central.pm,1.275,1.276 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.275 retrieving revision 1.276 diff -u -r1.275 -r1.276 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:42:45 1.275 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 14:34:17 1.276 @@ -2928,14 +2928,22 @@ Returns : output XML (see below) Args : Input XML (see below). Notes : expandRelationships behaviour - - for ISA relationships means traverse to root - - for HAS and HASA means traverse ISA to root and - grab all HAS or HASA's along the way + - for ISA relationships means traverse to root/leaves + - for HAS and HASA means traverse ISA to root/leaves and + for each node in the ISA hierarchy return the HAS/HASA + relationship partners, where 'root' matches container objects + and 'leaves' matches contained objects. + Example: suppose a relationship "objA HAS objB", + a) if query is objectType=>objA, direction=>'root', relationship=>'HAS', + then objB is in result set + b) if query is objectType=>objB, direction=>'leaves', relationship=>'HAS', + then objA is in result set input XML : $term 1|0 + root|leaves $relationship_term ... more relationship types ... @@ -2944,6 +2952,7 @@ $term 1|0 + root|leaves $relationship_term ... more relationship types ... @@ -2988,9 +2997,20 @@ my $expand_relationship = &_nodeTextContent( $doc, 'expandRelationship' ); $expand_relationship =~ s/\s//g; $expand_relationship ||= 0; + + + # find out direction: + my $direction = &_nodeTextContent( $doc, "direction" ); + $direction = 'root' unless $direction; # make root default to stay compatible + # it has to be either 'leaves' or 'root' + $direction = ($direction eq 'leaves') ? 'leaves' : 'root'; + + my %reltypes; my $relationship; + + for ( my $n = 1 ; $n <= $l ; ++$n ) { my @child = $x->get_node($n)->childNodes; foreach (@child) { @@ -3027,7 +3047,7 @@ term => $term, expand => $expand_relationship, relationship => $relationship, - direction => 'root' + direction => $direction, )}); # %relationships_found = $rels{relationship_lsid} = [lsid, lsid,lsid] } From kawas at dev.open-bio.org Tue Jan 30 09:37:19 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 30 Jan 2007 09:37:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301437.l0UEbJN2001798@dev.open-bio.org> kawas Tue Jan 30 09:37:19 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv1763 Modified Files: CommonSubs.pm Log Message: getExceptions wasnt working properly if the attributes were prefixed moby. moby-live/Perl/MOBY CommonSubs.pm,1.91,1.92 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2006/06/07 20:35:22 1.91 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2007/01/30 14:37:19 1.92 @@ -803,9 +803,9 @@ foreach my $n ( 1 .. ( $responses->size() ) ) { my $except={}; my $resp = $responses->get_node( $n ); - $except->{refElement}=$resp->getAttribute("refElement"); - $except->{refQueryID}=$resp->getAttribute("refQueryID"); - $except->{severity}=$resp->getAttribute("severity"); + $except->{refElement}=$resp->getAttribute("refElement") | $resp->getAttribute("moby:refElement"); + $except->{refQueryID}=$resp->getAttribute("refQueryID") | $resp->getAttribute("moby:refQueryID"); + $except->{severity}=$resp->getAttribute("severity") | $resp->getAttribute("moby:severity"); foreach my $child ($resp->childNodes) { if ($child->toString=~/exceptionCode>(.+)<\//) {$except->{exceptionCode}=$1}; if($child->toString=~/exceptionMessage>(.+)<\//) {$except->{exceptionMessage}=$1}; From d.haase at dev.open-bio.org Tue Jan 30 09:37:44 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:37:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301437.l0UEbiQU001827@dev.open-bio.org> d.haase Tue Jan 30 09:37:44 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1743 Modified Files: Central.pm Log Message: Added optional argument 'direction' to allow for querying 'leaves' direction. Also extended the query XML by new tag . moby-live/Perl/MOBY/Client Central.pm,1.142,1.143 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.142 retrieving revision 1.143 diff -u -r1.142 -r1.143 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/30 00:32:54 1.142 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/30 14:37:44 1.143 @@ -1723,6 +1723,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) expandRelationships => [1/0] (optional) + direction => ['root'/'leaves'] (optional) =cut @@ -1733,6 +1734,9 @@ my $expand = $args{'expandRelationships'}; $expand = $args{'expandRelationship'} unless defined($expand); # be forgiving of typos + my $direction = $args{'direction'} ? + $args{'direction'} : + 'root'; # make 'root' default to stay compatible my @relationships; @relationships = @{ $args{'Relationships'} } if ( $args{'Relationships'} @@ -1751,6 +1755,7 @@ $m .= "$_\n"; } $m .= "1\n" if $expand; + $m .= "$direction\n"; $m .= ""; $reg = $reg ? $reg : $self->default_MOBY_servername; return undef unless ( $self->Connection($reg) ); @@ -1766,6 +1771,7 @@ $m .= "$_\n"; } $m .= "1\n" if $expand; + $m .= "$direction\n"; $m .= ""; $reg = $reg ? $reg : $self->default_MOBY_servername; return undef unless ( $self->Connection($reg) ); @@ -1776,7 +1782,6 @@ return &_relationshipsPayload($payload); } - sub _relationshipsPayload { my ($payload) = @_; return undef unless $payload; From d.haase at dev.open-bio.org Tue Jan 30 09:49:20 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:49:20 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301449.l0UEnK4B001939@dev.open-bio.org> d.haase Tue Jan 30 09:49:20 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv1900 Modified Files: OntologyServer.pm Log Message: Re-implementation of methods Relationships and traverseDAG; reduces DB interaction and enables expansion to 'leaves' direction in Relationships; traverseDAG now uses Relationships call internally. moby-live/Perl/MOBY OntologyServer.pm,1.101,1.102 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2006/03/23 18:00:50 1.101 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2007/01/30 14:49:20 1.102 @@ -63,6 +63,7 @@ =cut package MOBY::OntologyServer; + use strict; use Carp; use vars qw($AUTOLOAD); @@ -1253,122 +1254,232 @@ =cut sub Relationships { - - # this entire subroutine assumes that there is NOT multiple parenting!! - my ( $self, %args ) = @_; - my $ontology = $args{ontology} ? $args{ontology} : $self->ontology; - - my $results; - if ( $ontology eq 'service' ) { - $results = &_ServiceRelationships($self, %args); - } elsif ( $ontology eq 'object' ) { - $results = &_ObjectRelationships($self, %args); - } else { - return {[]}; - } - return $results; -} - -sub _ServiceRelationships { - my ($self, %args) = @_; - my %results = []; - my $term = $args{term}; - my $relationship = $args{relationship}; - my $direction = $args{direction} ? $args{direction} : 'root'; - my $expand = $args{expand} ? 1 : 0; - my $ontology = "service"; - return \%results unless ($term); - - $term = $self->getServiceURI($term); - $relationship ||="isa"; - my $OS = MOBY::OntologyServer->new(ontology => 'relationship'); - $relationship = $OS->getRelationshipURI("service", $relationship); - - while ($term && (!($term =~ /urn\:lsid\:biomoby.org\:servicetype\:Service\:/ ) )){ - my $defs = $self->_doRelationshipsQuery($ontology,$term,$relationship,$direction ); - next unless $defs; # somethig has gone terribly wrong! - my $lsid; - my $rel; - my $articleName; - foreach ( @{$defs} ) { - $lsid = $_->[0]; - $rel = $_->[1]; - $articleName = $_->[2]; - $articleName ||=""; - my $info = $self->serviceInfo(term => $lsid); # we need to get the term name, and that doesn't come from here - my $term = $info->{service_type}; - push @{ $results{$rel} }, {lsid => $lsid, term => $term}; - } - last unless ($expand); - last unless ( $direction eq "root" ); # if we aren't going to root, then be careful or we'll loop infnitely - $term = $lsid; # this entire subroutine assumes that there is NOT multiple parenting... - } - - return \%results; -} - -sub _ObjectRelationships { - my ($self, %args) = @_; - my %results = []; - my $term = $args{term}; - my $relationship = $args{relationship}; - my $direction = $args{direction} ? $args{direction} : 'root'; - my $expand = $args{expand} ? 1 : 0; - my $ontology = 'object'; - return \%results unless ($term); - $term = $self->getObjectURI($term); - $relationship ||="isa"; - my $OS = MOBY::OntologyServer->new(ontology => 'relationship'); - $relationship = $OS->getRelationshipURI("object", $relationship); - my $isa_relationship = $OS->getRelationshipURI("object", "ISA"); - return \%results unless $isa_relationship; # we need this to do the isa traversal to root when expanding the hasa and has relationships call - - my @isa_hierarchy = ($term); - while ($term && (!($term =~ /urn\:lsid\:biomoby.org\:servicetype\:Object\:/ ) )){ # first build the entire ISA hierarchy - my $defs = $self->_doRelationshipsQuery($ontology,$term,$isa_relationship,$direction ); - next unless $defs; # somethig has gone terribly wrong! - my $lsid; - my $def = shift @{$defs}; # for ISA there should be only one parent - $lsid = $def->[0]; # the lsid is in slot 0 - push @isa_hierarchy, $lsid if $lsid; - $term = $lsid; # this entire subroutine assumes that there is NOT multiple parenting... - } - foreach my $node(@isa_hierarchy){ # now traverse along the ISA hierarchy and get what you need - my $defs = $self->_doRelationshipsQuery($ontology,$node,$relationship,$direction ); - next unless $defs; # somethig has gone terribly wrong! - my $lsid; - my $rel; - my $articleName; - foreach ( @{$defs} ) { - next unless $_->[0]; - $lsid = $_->[0]; - $rel = $_->[1]; - $articleName = $_->[2]; - $articleName ||=""; - my $info = $self->objectInfo(term => $lsid); # we need to get the term name, and that doesn't come from here - my $term = $info->{object_type}; - push @{ $results{$rel} }, {lsid => $lsid, articleName => $articleName, term => $term}; - } - last unless ($expand); - last unless ( $direction eq "root" ); # if we aren't going to root, then be careful or we'll loop infnitely - $term = $lsid; # this entire subroutine assumes that there is NOT multiple parenting... - } - return \%results; -} - -sub _doRelationshipsQuery { - my ( $self, $ontology, $term, $relationship, $direction ) = @_; - $CONFIG ||= MOBY::Config->new; # exported by Config.pm - my $datasource = "moby$ontology"; # like mobyobject, or mobyservice - my $adaptor = $CONFIG->getDataAdaptor( datasource => $datasource ); - my $defs; - # query returns a reference to an array containing array references - $defs = $adaptor->get_relationship(direction => $direction, - ontology => $ontology, - term => $term, - relationship => $relationship); - # a very long piece of SQL statements have been refactored into Moby::Adaptor::moby::queryapi::mysql.pm - return $defs; + my ($self, %args) = @_; + my %results; + + my $term = $args{term}; + my $ontology = $args{ontology} ? $args{ontology} : $self->ontology; + my $direction = $args{direction} ? $args{direction} : 'root'; + $direction = $direction eq 'root'? 'root' : 'leaves'; # map anything else to 'leaves' + my $relationship = $args{relationship}; + my $expand = $args{expand} ? 1 : 0; + + # in order to make this function also usable for 'traverseDAG' + # we need a more precise definition what to expand. Note that + # the default settings assure the behaviour of the old 'expand' param. + # 1. expand along the isa relationship? + my $isaExpand = $args{isaExpand} ? $args{isaExpand} : $expand; + # 2. expand along the inclusion relationship types (has/hasa), + # i.e. get inclusions of inclusions? + # (Note: this is set when called by 'traverseDAG') + my $incExpand = $args{incExpand} ? $args{incExpand} : 0; + # 3. explore inclusion relationships for complete isa hierarchy? + # (Note: this was fix behaviour of the old 'expand', + # but is not used by traverseDAG) + my $mapIncToIsa = $args{mapIncToIsa} ? $args{mapIncToIsa} : $expand; + + # first of all, get ID of query entity, + # internally, we will operate on pure IDs + # as long as possible... + $CONFIG ||= MOBY::Config->new; # exported by Config.pm + my $datasource = "moby$ontology"; # like mobyobject, or mobyservice + my $adaptor = $CONFIG->getDataAdaptor( datasource => $datasource ); + my $queryId; + my $query_method = "query_$ontology"; + my $result = $adaptor->$query_method(type => $term); + my $row = shift @$result; + $queryId = $row->{"${ontology}_id"}; + + return {} unless $queryId; + + # get all relationships in the database in one query + my $relHash = $adaptor->get_all_relationships(direction=>$direction,ontology=>$ontology); + + # find out which relationships to return + # use keys of %$relHash, because these are lsids: + + # initialize to return all relationships (becomes effective if eg. 'all' was used) + my @relList = keys %$relHash; + if ( (not $relationship) or # ISA (and nothing else) is the default if nothing specified + ($relationship =~ /isa$/i) ) { + @relList = grep { /isa$/i } @relList; + } + elsif ( $relationship =~ /has(a)?$/i ) { + # if either has or hasa was specified, use only that + @relList = grep { /$relationship$/i } @relList; + } + + # build the isa hierarchy, it's needed in any case... + my ($isaLsid) = grep { /isa$/i } keys %$relHash; # we need the lsid... + my $isa_hierarchy = $self->_getIsaHierarchy($relHash->{$isaLsid}, $queryId, $direction, $isaExpand); + + # prepare the hash for storing HAS/HASA relationship details + my $hasRelDetails; + + # table fields needed to get entity details: + my @fields = ("${ontology}_lsid","${ontology}_type"); + + # nodes to check for has/hasa relationship + my @checkNodes = ($queryId); + # mapIncToIsa means that has/hasa has to be checked + # not only for the query object alone but also for all + # isa ancestors/descendants + push @checkNodes, @$isa_hierarchy if $mapIncToIsa; + + # the result hash will consist of one list for each included relationship type... + foreach my $rel ( @relList ) { + my @entityQueryList = (); # this collects the unique object ids + my @entityResultList = (); # this collects ids of objects to add to the result, maybe not unique + # the latter one is not essential to have, the only benefit is + # a somehow predictable order in the output... + + # find out which entities we have to include in the result + # and how these are related to each other; + # Note: all needed information is present in the relationship hash %$relHash! + + if ( $rel ne $isaLsid ) { + # either HAS or HASA + foreach my $node ( @checkNodes ) { + my $incls = $self->_getInclusions($relHash,$node,[$rel], $incExpand); + foreach my $triplet ( @$incls ) { + my ($inclId, $inclArtName, $inclAssert) = @$triplet; + $hasRelDetails->{$inclId}->{$inclAssert} = $inclArtName; + push @entityResultList, $inclId; + } + } + # set up list of unique object ids for the database lookup + @entityQueryList = keys %$hasRelDetails; + } + else { + # ISA + @entityQueryList = @$isa_hierarchy; # isa hierarchy is guaranteed to be unique... + @entityResultList = @$isa_hierarchy; # ... but still both variables have to be set + } + + # now it's time to move away from pure ids, retrieve details from database: + my $details = $adaptor->get_details_for_id_list($ontology, \@fields, \@entityQueryList); + + # enhance details with information about relationships and build result hash + foreach my $entityId (@entityResultList) { + # add articleName slot if necessary + if ( exists $hasRelDetails->{$entityId} ) { + foreach my $assert ( keys %{$hasRelDetails->{$entityId}} ) { + $details->{$entityId}->{'articleName'} = $hasRelDetails->{$entityId}->{$assert}; + } + } + elsif ( $ontology eq 'object') { + # for isa, articleName is the empty string + $details->{$entityId}->{'articleName'} = ''; + } + + # map ontology specific field names to commons slots: + # 1. 'object_lsid'/'service_lsid' -> 'lsid' + $details->{$entityId}->{'lsid'} = $details->{$entityId}->{"${ontology}_lsid"} + unless exists $details->{$entityId}->{'lsid'}; # do just once foreach object! + delete $details->{$entityId}->{"${ontology}_lsid"}; # remove redundant slot + # 2. 'object_type'/'service_type' -> 'term' + $details->{$entityId}->{'term'} = $details->{$entityId}->{"${ontology}_type"} + unless exists $details->{$entityId}->{'term'}; # do just once foreach object! + delete $details->{$entityId}->{"${ontology}_type"}; # remove redundant slot + + # finally, add record to the result hash + push @{ $results{$rel} }, $details->{$entityId}; + } + } + return \%results; +} + +sub _getIsaHierarchy { + # Finds out the isa hierarchy for the query entity, that is + # the parent (the one which it inherits from) if direction is 'root' or + # the children (one or more which inherit from it) if direction is 'leaves'. + # If 'expand' is set all deeper levels (ancestors or descendants if you like) + # are also included. + # Note 1: this implementation relies on pure single inheritance! + # Note 2: we can use the same method for both directions only because the + # provided isaHash is built with the direction in mind, make sure + # to have direction consistent! + + # returned is a reference to a flat list + + my ($self, $isaHash, $query, $direction, $expand) = @_; + + my @hierarchy = (); + if ( exists $isaHash->{$query} ) { + if ( $direction eq 'root' ) { + # push the parent entity + push @hierarchy, $isaHash->{$query}; # relies on single inheritance! + } + elsif ( $direction eq 'leaves' ) { + # push the direct children + push @hierarchy, @{$isaHash->{$query}}; + } + else { + # it has to be either 'root' or 'leaves' + warn "_getIsaHierarchy was called with wrong direction indicator, + use either 'root' or 'leaves'!\n"; + return []; + } + if ( $expand ) { + my @firstLevel = @hierarchy; + foreach my $entity ( @firstLevel ) { + my $deeperLevels = $self->_getIsaHierarchy($isaHash, $entity, $direction, 1); + push @hierarchy, @$deeperLevels; + } + } + return \@hierarchy; + } + else { + # important: anchor the recursion! + return []; + } +} + +sub _getInclusions { + + # Finds out the objects related to the query by one of the inclusion + # relationships (HAS or HASA). This is the HAS/HASA-analogue to + # _getIsaHierarchy, but is more complicated, because the values in + # the provided relationship hash ($relHash) are not simple ids but + # triplets ("relationship records") in the format of: + # [id of relationship partner, articleName, assertion id] + # On the other hand, direction does not matter here, because + # we have to deal with multi relationships in any case. + # Like for ISA, be aware that the relationship hash '$relHash' + # is built direction dependant. Make sure to use it consistently! + + # Note: third argument is a listref of relationship types, that is + # it could be called with HAS and HASA (expected are lsids) at + # the same time and in this way merge both inclusion relationship + # types. However, this usage is not used currently and not tested! + + # Returned is a reference to a list with each element being + # a triplet (listref to a relationship record) as explained above. + + my ($self, $relHash, $query, $relList, $expand) = @_; + + my %nodeCheckDone; # for avoiding multiple check of one node (if expand is set) + my @allInclusions = (); + foreach my $relType ( @$relList ) { + # 'root' means: include all relationships where query is the + # containing (outer) object; + # eg. if A HAS B, and A is query, include this record + if ( exists $relHash->{$relType}->{$query} ) { + my $relRecords = $relHash->{$relType}->{$query}; + foreach my $record ( @$relRecords ) { + push @allInclusions, $record; + if ( $expand ) { + my ($incId, $artName, $assert) = @$record; + if ( not exists $nodeCheckDone{$incId} ) { + my $deeperInclusions = $self->_getInclusions($relHash, $incId, $relList, 1); + push @allInclusions, @$deeperInclusions; + $nodeCheckDone{$incId}++; + } + } + } + } + } + return \@allInclusions; # empty if nothing found, this anchors the recursion } =head2 setURI @@ -1402,73 +1513,40 @@ =cut sub traverseDAG { - my ( $self, $term, $direction ) = @_; - my $ontology = $self->ontology; - return {} unless $ontology; - return {} unless $term; - $direction = "root" unless ($direction); - return {} unless ( ( $direction eq 'root' ) || ( $direction eq 'leaves' ) ); - if ( $ontology eq 'service' ) { - $term = $self->getServiceURI($term); - } elsif ( $ontology eq 'object' ) { - $term = $self->getObjectURI($term); - } - return {} unless $term =~ /^urn\:lsid/; # now its a URI - my $relhash = $self->getRelationshipTypes( ontology => $ontology ); # get teh types of relationships for the object/service ontology - return {} unless $relhash; - my @rels = keys %{$relhash}; #@rels is the list of relationship types for that ontology - my %relationships; - foreach my $relationship (@rels) { - my %IDS; - my $OS = MOBY::OntologyServer->new( ontology => 'relationship' ); - my $reluri = - $OS->getRelationshipURI( $ontology, $relationship ) - ; # get the URI for that relationship type if it ins't already a URI - $IDS{$term} = "untestedroot"; # mark the one in-hand as being untested - while ( grep /untested/, ( values %IDS ) ) - { # now, while there are untested services in our list... - foreach my $termthingy ( keys %IDS ) - { # start parsing through the current list (hash keys) - $debug && _LOG("testing $relationship of $termthingy\n"); - next - if ( $IDS{$termthingy} eq "tested" ) - ; # if it has been tested already then move on - my $lsids = $self->Relationships( - term => $termthingy, - relationship => $relationship, - direction => $direction - ) - ; # get the related terms for this type; this should return a single hash value - if ( $IDS{$termthingy} =~ /root/ ) - { # here is where we remove self - delete $IDS{$termthingy}; - $debug && _LOG("deleting $termthingy\n"); - } else { - $debug && _LOG("marking $termthingy as TESTED\n"); - $IDS{$termthingy} = - "tested"; # mark the current one as now being "done" - } - - #${$lsids}{relationshiptype}=[lsid, lsid, lsid]; - foreach my $lsid_article ( @{ $lsids->{$relationship} } ) - { # go through the related terms - my $lsid = $lsid_article->{lsid}, - my $article = $lsid_article->{articleName}; - $debug && _LOG("found $lsid as relationship"); - next - if ( defined $IDS{$lsid} ) - ; # if we have already seen that term, skip it - $debug && _LOG("setting $lsid as untested\n"); - $IDS{$lsid} = - "untested" # otherwise add it to the list and loop again. - } - } - } - my @IDS = keys %IDS; - $relationships{$relationship} = - \@IDS; # and associate them all with the current relationship type - } - return \%relationships; + my ( $self, $term, $direction ) = @_; + my $ontology = $self->ontology; + return {} unless $ontology; + return {} unless $term; + $direction = "root" unless ($direction); + return {} unless ( ( $direction eq 'root' ) || ( $direction eq 'leaves' ) ); + if ( $ontology eq 'service' ) { + $term = $self->getServiceURI($term); + } elsif ( $ontology eq 'object' ) { + $term = $self->getObjectURI($term); + } + return {} unless $term; # search term not in db! + return {} unless $term =~ /^urn\:lsid/; # now its a URI + + my $result = {}; + # get the types of relationships for the object/service ontology + my $relTypeHash = $self->getRelationshipTypes( ontology => $ontology ); + my $relHash = $self->Relationships( term => $term, + direction => $direction, + ontology => $ontology, + isaExpand => 1, + incExpand => 1, + mapIncToIsa => 0, + relationship => 'all'); + foreach my $relType ( keys %$relTypeHash ) { + $result->{$relType} = []; + my %tmpHash; # avoid doubles! + my $relList = $relHash->{$relType}; + foreach my $rel ( @$relList ) { + $tmpHash{$rel->{'lsid'}}++; + } + @{$result->{$relType}} = keys %tmpHash; + } + return $result; } sub _LOG { From d.haase at dev.open-bio.org Tue Jan 30 09:57:47 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:57:47 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301457.l0UEvlmS002046@dev.open-bio.org> d.haase Tue Jan 30 09:57:47 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby In directory dev.open-bio.org:/tmp/cvs-serv2011 Modified Files: queryapi.pm Log Message: Added interfaces for new methods 'get_all_relationships' and 'get_details_for_id_list' moby-live/Perl/MOBY/Adaptor/moby queryapi.pm,1.31,1.32 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/11/20 15:45:35 1.31 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2007/01/30 14:57:47 1.32 @@ -1308,11 +1308,75 @@ die "get_relationship not implemented in adaptor\n"; } +=head2 get_all_relationships + + Title : get_all_relationships + Usage : my $un = $API->get_all_relationships(%args) + Function : Execute a query for all relationships represented in $ontology_term2term + Args : direction => String - direction in the ontology (either 'root' or 'leaves') + ontology => String - name of the table ontology + Returns : reference to hash with the following structure: + $resultHash->{String relationship_type}->{Integer key_entity_id} = + The structure of depends on relationship_type and direction: + HAS/HASA : + = @([Integer value_entity_id, String articleName, Integer assertion_id]) + ISA, leaves : + = @(Integer value_entity_id) + ISA, root : + = Integer value_entity_id + Notes : The hash is built 'direction-aware', that is for + - root : key_entity_id = ${ontology}1_id, value_entity_id = ${ontology}2_id + - leaves: key_entity_id = ${ontology}2_id, value_entity_id = ${ontology}1_id + The structure of the result hash is a bit complex because it is specifically + designed for usage by MOBY::OntolgyServer::Relationships + The result hash contains the entire table ${ontology}_term2term in order to + reduce DB interaction in the ontology exploration + +=cut + +# Get all relationships in the queried database in one go. The +# complete table ${ontology}_term2term is transferred into a hash +# whose reference is finally returned. Important: note that the hash +# is built 'direction aware', that is for objects 'object1_id' is used +# as key when direction is 'root' and 'object2_id' as value. Vice +# versa for the 'leaves' direction. Likewise for services. +# Returns a hash reference. +sub get_all_relationships{ + die "get_all_relationships not implemented in adaptor\n"; +} + +=head2 get_deails_for_id_list + + Title : get_deails_for_id_list + Usage : my $un = $API->get_all_relationships($ontology, $field_list, $id_list) + Function : Retrieve details specified in @$field_list from $ontology for ids in @$id_list + Args : $ontology => String - name of the table ontology + $field_list => Reference to array of Strings representing table fields in $ontology + $id_list => Reference to array of Integers representing ${ontology}_ids + Returns : reference to hash with the following structure: + $resultHash->{Integer ${ontology}_id}->{String field_name} = field_value + Notes : This function is generic with respect to which details (fields) are retrieved, but + is restricted to those tables whose name is identical to the ontology name (i.e. + currently 'object', 'service', 'namespace' and 'relationship') + Makes use of the 'select ... from ... where ... in ()' statement syntax + in order to reduce the number of DB interactions + Used in MOBY::OntologyServer::Relationships, but maybe useful for other purposes... + +=cut + +# retrieve details for a number of entities from table $ontology +# represented by a list of ${ontology}_id's; +# used in MOBY::OntologyServer::Relationships +sub get_details_for_id_list { + die "get_details_for_id_list not implemented in adaptor\n"; +} + + # Not quite sure what this does... sub _checkURI { die "_checkURI not implemented in adaptor\n"; } - + sub _dump { my ($self) = @_; foreach my $attrname ( $self->_standard_keys ) { From d.haase at dev.open-bio.org Tue Jan 30 10:08:33 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 10:08:33 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301508.l0UF8Xoj002218@dev.open-bio.org> d.haase Tue Jan 30 10:08:33 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory dev.open-bio.org:/tmp/cvs-serv2183 Modified Files: mysql.pm Log Message: Added new methods for usage in MOBY::OntologyServer::Relationships: get_all_relationships and get_details_for_id_list. Also fixed a bug in get_relationship (select statement for 'leaves' direction), but I guess this method isn't used any longer due to re-implementation of MOBY::OntologyServer::Relationships anyway... moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.81,1.82 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/30 00:26:18 1.81 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/30 15:08:33 1.82 @@ -1371,7 +1371,7 @@ } else { unless ( defined $relationship ) { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from + select distinct s1.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 @@ -1381,7 +1381,7 @@ s2.${ontology}_lsid = ?", undef, $lsid); # ") } else { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from + select distinct s1.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 @@ -1395,6 +1395,93 @@ return $defs; } +# Get all relationships in the queried database in one go. The +# complete table ${ontology}_term2term is transferred into a hash +# whose reference is finally returned. Important: note that the hash +# is built 'direction aware', that is for objects 'object1_id' is used +# as key when direction is 'root' and 'object2_id' as value. Vice +# versa for the 'leaves' direction. Likewise for services. +# Returns a hash reference. +sub get_all_relationships { + + my ($self, %args) = @_; + my $direction = $args{'direction'}; + my $ontology = $args{'ontology'}; + # my $relationship = $args{'relationship'}; # has to be lsid! + + my $relHash; + my $dbh = _getDBHandle("moby$ontology"); + + my $statement = "select ${ontology}1_id, ${ontology}2_id, relationship_type"; + $statement .= ", object2_articlename, assertion_id " if $ontology eq 'object'; + $statement .= " from ${ontology}_term2term"; + # my $relationship_lsid = "urn:lsid:biomoby.org:${ontology}relation:isa"; + my $defs = $dbh->selectall_arrayref($statement); + + return {} unless @$defs; + foreach my $def (@$defs) { + my $relationship = $def->[2]; + if ( $relationship =~ /has/i ) { + # HAS or HASA + # >1 has/hasa child possible; also store articlename and assertion_id + # hash structure: $relHash->{has/a-lsid}->{object1_id}->[object2_id,articlename,assertion_id] + push @{$relHash->{$relationship}->{$def->[0]}}, [$def->[1],$def->[3],$def->[4]] if $direction eq 'root'; + push @{$relHash->{$relationship}->{$def->[1]}}, [$def->[0],$def->[3],$def->[4]] if $direction eq 'leaves'; + } + elsif ( $relationship =~ /isa/i ) { + # ISA + push @{$relHash->{$relationship}->{$def->[1]}}, $def->[0] if $direction eq 'leaves'; # >1 child possible! + $relHash->{$relationship}->{$def->[0]} = $def->[1] if $direction eq 'root'; # no multi parents! + } + else { return {}; } + } + return $relHash; +} + +# retrieve details for a number of entities from table $ontology +# represented by a list of ${ontology}_id's; +# used in MOBY::OntologyServer::Relationships +sub get_details_for_id_list { + my ($self, $ontology, $fields, $idList) = @_; + + return {} unless @$idList; + return {} unless @$fields; + + my $dbh = _getDBHandle("moby$ontology"); + my $result = {}; + + # avoid errors due to wrong field names: + my %existingFields; + my @queryFields = (); + my $resArray = $dbh->selectall_arrayref("SHOW COLUMNS FROM $ontology"); + foreach my $row ( @$resArray ) { + $existingFields{$row->[0]}++; + } + foreach my $field ( @$fields ) { + next if $field eq "${ontology}_id"; + if ( exists $existingFields{$field} ) { + push @queryFields, $field; + } + else { + warn "Requested field $field does not exist in table $ontology!"; + } + } + + # + my $statement = "select ${ontology}_id, ". join(",", @queryFields). + " from $ontology where ${ontology}_id in (" . + join(",", @$idList) . ")"; + $resArray = $dbh->selectall_arrayref($statement); + foreach my $row ( @$resArray ) { + my $entityId = shift @$row; + foreach my $field (@queryFields) { + my $value = shift @$row; + $result->{$entityId}->{$field} = $value ? $value : ''; + } + } + return $result; +} + sub _checkURI { # my $uri = "http://www.ics.uci.edu/pub/ietf/uri/#Related"; From mwilkinson at dev.open-bio.org Tue Jan 30 17:50:52 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Tue, 30 Jan 2007 17:50:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701302250.l0UMoqVW003562@dev.open-bio.org> mwilkinson Tue Jan 30 17:50:52 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv3543/MOBY Modified Files: CommonSubs.pm Log Message: not a bitwise comparison moby-live/Perl/MOBY CommonSubs.pm,1.92,1.93 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2007/01/30 14:37:19 1.92 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2007/01/30 22:50:52 1.93 @@ -803,9 +803,9 @@ foreach my $n ( 1 .. ( $responses->size() ) ) { my $except={}; my $resp = $responses->get_node( $n ); - $except->{refElement}=$resp->getAttribute("refElement") | $resp->getAttribute("moby:refElement"); - $except->{refQueryID}=$resp->getAttribute("refQueryID") | $resp->getAttribute("moby:refQueryID"); - $except->{severity}=$resp->getAttribute("severity") | $resp->getAttribute("moby:severity"); + $except->{refElement}=$resp->getAttribute("refElement") || $resp->getAttribute("moby:refElement"); + $except->{refQueryID}=$resp->getAttribute("refQueryID") || $resp->getAttribute("moby:refQueryID"); + $except->{severity}=$resp->getAttribute("severity") || $resp->getAttribute("moby:severity"); foreach my $child ($resp->childNodes) { if ($child->toString=~/exceptionCode>(.+)<\//) {$except->{exceptionCode}=$1}; if($child->toString=~/exceptionMessage>(.+)<\//) {$except->{exceptionMessage}=$1}; From kawas at dev.open-bio.org Wed Jan 31 11:17:43 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 31 Jan 2007 11:17:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701311617.l0VGHhHt007397@dev.open-bio.org> kawas Wed Jan 31 11:17:43 EST 2007 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv7362 Modified Files: Client-OntologyServer.t Log Message: rub1 wasnt beening removed at the end of the test moby-live/Perl/t Client-OntologyServer.t,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2005/12/19 20:08:44 1.7 +++ /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2007/01/31 16:17:43 1.8 @@ -1,179 +1,182 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' - -# Note added by Frank Gibbons. -# Tests should, as far as possible, avoid the use of literals. -# If you register a service with authURI => mysite.com, -# and you want to test a retrieved description of the service, -# don't test that the service returns authURI eq "mysite.com", -# test so that it returns the same value as you used to register it in the first place. - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; -#use SOAP::Lite +trace; -use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details -use strict; -use MOBY::Client::OntologyServer; -use MOBY::Client::Central; -BEGIN { use_ok('MOBY::Client::OntologyServer'); - # initialize with a couple of useless things that we can guarantee to find - my $C = MOBY::Client::Central->new(); - - my %Namespace = ( namespaceType => 'Rub1', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - my $r = $C->registerNamespace( %Namespace ); - %Namespace = ( namespaceType => 'Rub2', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - $r = $C->registerNamespace( %Namespace ); - my %ServiceType = ( serviceType => "Rub1", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType ); - %ServiceType = ( serviceType => "Rub2", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType );}; - -END { - # Define cleanup of registry, to return it to its 'pristine' state, - # so that later attempts to run tests don't run into problems caused - # by failure of these tests, or abortion of the test script. - # Reconnect to MOBY Central here, since other connections - # will have gone out of scope by the time we get to this END block. - # Also can't use %Obj, - my $C = MOBY::Client::Central->new(); - my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); - $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); - $r = $C->deregisterServiceType( serviceType => 'Rub2' ); - $r = $C->deregisterServiceType( serviceType => 'Rub2' ); -}; - - -my @autoload = qw/host proxy/; -my @API = (@autoload, qw/new getUserAgent -objectExists serviceExists namespaceExists /); - -my $os = MOBY::Client::OntologyServer->new(); - -if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { - print STDERR <host,"\n\n\n"; -} - -foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. -can_ok("MOBY::Client::OntologyServer", @API) - or diag("OntologyServer doesn't implement full API"); - -# Check that accessor methods work correctly; -my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); -my ($new_host, $new_proxy) = ("foo.cgi", "bar"); -is($os->host($new_host), $new_host) or diag("Couldn't set new host"); -is($os->host(), $new_host) or diag("Couldn't get host"); -is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); - is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); - is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); -TODO: { - local $TODO = "How come I cant' set proxy back to its original value?"; - is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); -} - -# Start fresh.... -$os = MOBY::Client::OntologyServer->new(); - -my ($success, $msg, $existingURI); -my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid -foreach (@check_ns) { - ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); - is($success, 1) - or diag("Namespace '$_' reported erroneously as non-existent."); -} - -# Could get these allowed datatypes from MOBY::Config, -# except that module only works when you've got a local registry set up. -my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid -foreach (@check_obj) { - ($success, $msg, $existingURI) = $os->objectExists(term => $_); - is($success, 1) - or diag("Object '$_' reported erroneously as non-existent."); -} - -my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... -foreach (@check_servicetype) { - ($success, $msg, $existingURI) = $os->serviceExists(term => $_); - is($success, 1) - or diag("Service type '$_' reported erroneously as non-existent."); -} - -SKIP: { - skip "relationshipExists not implemented", 5 - unless MOBY::Client::OntologyServer->can("relationshipExists"); - - can_ok("MOBY::Client::OntologyServer", "relationshipExists") - or diag("OntologyServer should be able to tell whether a relationship exists"); - my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. - foreach (@check_rel) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. - foreach (@check_rel2) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - - my $invalid_rel = "HA"; - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); -} - - -######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### -# -# Literal invalid names are OK here, since there's no obvious way to generate them -# and guarantee that they'll be invalid. -# -my $invalid_ns = "InvalidNS"; -($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); -is($success, 0) - or diag("Namespace '$invalid_ns' reported erroneously as existent."); - -my $invalid_obj = "InvalidObject"; -($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); -is($success, 0) - or diag("Object '$invalid_obj' reported erroneously as existent."); - -my $invalid_st = "InvalidServiceType"; -($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); -is($success, 0) - or diag("Service type '$invalid_st' reported erroneously as existent."); - +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 1.t' + +# Note added by Frank Gibbons. +# Tests should, as far as possible, avoid the use of literals. +# If you register a service with authURI => mysite.com, +# and you want to test a retrieved description of the service, +# don't test that the service returns authURI eq "mysite.com", +# test so that it returns the same value as you used to register it in the first place. + +######################### + +# change 'tests => 1' to 'tests => last_test_to_print'; +#use SOAP::Lite +trace; +use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details +use strict; +use MOBY::Client::OntologyServer; +use MOBY::Client::Central; +BEGIN { use_ok('MOBY::Client::OntologyServer'); + # initialize with a couple of useless things that we can guarantee to find + my $C = MOBY::Client::Central->new(); + + my %Namespace = ( namespaceType => 'Rub1', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + my $r = $C->registerNamespace( %Namespace ); + %Namespace = ( namespaceType => 'Rub2', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + $r = $C->registerNamespace( %Namespace ); + my %ServiceType = ( serviceType => "Rub1", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + %ServiceType = ( serviceType => "Rub2", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + }; + + +END { + # Define cleanup of registry, to return it to its 'pristine' state, + # so that later attempts to run tests don't run into problems caused + # by failure of these tests, or abortion of the test script. + # Reconnect to MOBY Central here, since other connections + # will have gone out of scope by the time we get to this END block. + # Also can't use %Obj, + my $C = MOBY::Client::Central->new(); + my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); + $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); + $r = $C->deregisterServiceType( serviceType => 'Rub1' ); + $r = $C->deregisterServiceType( serviceType => 'Rub2' ); + +}; + + +my @autoload = qw/host proxy/; +my @API = (@autoload, qw/new getUserAgent +objectExists serviceExists namespaceExists /); + +my $os = MOBY::Client::OntologyServer->new(); + +if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { + print STDERR <host,"\n\n\n"; +} + +foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. +can_ok("MOBY::Client::OntologyServer", @API) + or diag("OntologyServer doesn't implement full API"); + +# Check that accessor methods work correctly; +my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); +my ($new_host, $new_proxy) = ("foo.cgi", "bar"); +is($os->host($new_host), $new_host) or diag("Couldn't set new host"); +is($os->host(), $new_host) or diag("Couldn't get host"); +is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); + is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); + is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); +TODO: { + local $TODO = "How come I cant' set proxy back to its original value?"; + is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); +} + +# Start fresh.... +$os = MOBY::Client::OntologyServer->new(); + +my ($success, $msg, $existingURI); +my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid +foreach (@check_ns) { + ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); + is($success, 1) + or diag("Namespace '$_' reported erroneously as non-existent."); +} + +# Could get these allowed datatypes from MOBY::Config, +# except that module only works when you've got a local registry set up. +my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid +foreach (@check_obj) { + ($success, $msg, $existingURI) = $os->objectExists(term => $_); + is($success, 1) + or diag("Object '$_' reported erroneously as non-existent."); +} + +my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... +foreach (@check_servicetype) { + ($success, $msg, $existingURI) = $os->serviceExists(term => $_); + is($success, 1) + or diag("Service type '$_' reported erroneously as non-existent."); +} + +SKIP: { + skip "relationshipExists not implemented", 5 + unless MOBY::Client::OntologyServer->can("relationshipExists"); + + can_ok("MOBY::Client::OntologyServer", "relationshipExists") + or diag("OntologyServer should be able to tell whether a relationship exists"); + my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. + foreach (@check_rel) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. + foreach (@check_rel2) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + + my $invalid_rel = "HA"; + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); +} + + +######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### +# +# Literal invalid names are OK here, since there's no obvious way to generate them +# and guarantee that they'll be invalid. +# +my $invalid_ns = "InvalidNS"; +($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); +is($success, 0) + or diag("Namespace '$invalid_ns' reported erroneously as existent."); + +my $invalid_obj = "InvalidObject"; +($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); +is($success, 0) + or diag("Object '$invalid_obj' reported erroneously as existent."); + +my $invalid_st = "InvalidServiceType"; +($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); +is($success, 0) + or diag("Service type '$invalid_st' reported erroneously as existent."); + From kawas at dev.open-bio.org Wed Jan 17 19:58:45 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 17 Jan 2007 14:58:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701171958.l0HJwjrn004211@dev.open-bio.org> kawas Wed Jan 17 14:58:44 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv4176 Modified Files: Central.pm Log Message: updated the wsdl for async services. also fixed typo in _doAsyncWSDLReplacement. moby-live/Perl/MOBY Central.pm,1.268,1.269 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.268 retrieving revision 1.269 diff -u -r1.268 -r1.269 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/19 14:46:35 1.268 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/17 19:58:44 1.269 @@ -3210,7 +3210,7 @@ # we're just waiting for an example of an async # wsdl document from IMB my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; - my $wsdl = $WSDL_POST_TEMPLATE; + my $wsdl = $WSDL_ASYNC_TEMPLATE; $wsdl =~ s/^\n//gs; my $serviceName = $SI->servicename; my $AuthURI = $SI->authority_uri; @@ -4057,53 +4057,168 @@ $WSDL_ASYNC_TEMPLATE = < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + END From gordonp at dev.open-bio.org Fri Jan 19 18:32:36 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 19 Jan 2007 13:32:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701191832.l0JIWa2b010635@dev.open-bio.org> gordonp Fri Jan 19 13:32:36 EST 2007 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv10600/docs Modified Files: DataPackageInAnger.html Log Message: Fixed typos in DNASequence creation moby-live/Java/docs DataPackageInAnger.html,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2006/08/01 03:42:26 1.2 +++ /home/repository/moby/moby-live/Java/docs/DataPackageInAnger.html 2007/01/19 18:32:36 1.3 @@ -133,12 +133,12 @@ MobyDataComposite dnaSeqObj = new MobyDataComposite(dnaType, //type giNS, // namespace "123456", //id - "Sequence", "ATG", //begin (articleName, value) pairs + "SequenceString", "ATG", //begin (articleName, value) pairs "Length", "3"); Note that the constructor will automatically turn the value argument into a java.lang.String if it isn't already, then call the MobyDataObject.createInstanceFromString shown earlier with the - datatype specified in the ontology (moby:String for Sequence and moby:Integer for Length). + datatype specified in the ontology (moby:String for SequenceString and moby:Integer for Length).

If the value argument was already a MobyDataObject this process is avoided, @@ -148,7 +148,7 @@

 MobyDataString seqString = new MobyDataString("ATG");
 MobyDataComposite dnaSeqObj = new MobyDataComposite(dnaType, giNS, "123456", 
-                                                    "Sequence", seqString,
+                                                    "SequenceString", seqString,
                                                     "Length", "3");
 

From kawas at dev.open-bio.org Mon Jan 22 20:56:35 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 22 Jan 2007 15:56:35 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701222056.l0MKuZmS023061@dev.open-bio.org> kawas Mon Jan 22 15:56:34 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory dev.open-bio.org:/tmp/cvs-serv23025/Adaptor/moby/queryapi Modified Files: mysql.pm Log Message: bug fix for bug pointed out (and coded) by paul moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.79,1.80 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2006/05/31 21:12:19 1.79 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/22 20:56:34 1.80 @@ -1209,7 +1209,7 @@ my $ancestor_string = $args{'ancestor_string'}; my $namespaceURIs = $args{'namespaceURIs'}; - my $query ="select service_instance_id, namespace_type_uris from simple_$inout where object_type_uri in ($ancestor_string) and service_instance_id IS NOT NULL " + my $query ="select service_instance_id, namespace_type_uris from simple_$inout where object_type_uri in ($ancestor_string) and collection_input_id IS NULL " ; # if service_instance_id is null then it must be a collection input. my $nsquery; foreach my $ns ( @{$namespaceURIs} ) { # namespaces are already URI's From mwilkinson at dev.open-bio.org Mon Jan 22 21:19:34 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 22 Jan 2007 16:19:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701222119.l0MLJYuh023161@dev.open-bio.org> mwilkinson Mon Jan 22 16:19:34 EST 2007 Update of /home/repository/moby/moby-live/Docs/ProjectDocs In directory dev.open-bio.org:/tmp/cvs-serv23142/ProjectDocs Modified Files: index.html Log Message: ProjectDocs/index.html moby-live/Docs/ProjectDocs index.html,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/ProjectDocs/index.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Docs/ProjectDocs/index.html 2006/03/07 11:52:50 1.6 +++ /home/repository/moby/moby-live/Docs/ProjectDocs/index.html 2007/01/22 21:19:34 1.7 @@ -1,43 +1,43 @@ -

MOBY Project General Documentation

- -
-
jMoby documentation - -
jMoby contains libraries for Java developers, and it -also contains ready-to-use clients for any Biomoby users, allowing -access to Biomoby registries and to Biomoby services) - -
-

- -

Language Specific Documents

-

-
 

- -

FAQ's

-


- -

Catalogue of Registries

- - - - - - - - - - - - - - - - -
LocationEndpointPublic?DescriptionPolicy
iCAPTURE CentreEndpoint: http://mobycentral.icapture.ubc.ca/MOBY05/mobycentral.pl -
URI: http://mobycentral.icapture.ubc.ca/MOBY/Central
YESA curated public registry hosted at the iCAPTURE Centre, VancouverPolicy
IRRI PhilippinesEndpoint: http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl
- URI: http://cropwiki.irri.org/MOBY/Central
YESThe MOBY registry at the International Rice Research Institute -(IRRI) is intended mostly for Generation Challenge Program (GCP) -developers. It allows the registration of experimental moby entities -within GCP.Policy
- +

MOBY Project General Documentation

+ +
+
jMoby documentation + +
jMoby contains libraries for Java developers, and it +also contains ready-to-use clients for any Biomoby users, allowing +access to Biomoby registries and to Biomoby services) + +
+

+ +

Language Specific Documents

+

+
 

+ +

FAQ's

+


+ +

Catalogue of Registries

+ + + + + + + + + + + + + + + + +
LocationEndpointPublic?DescriptionPolicy
iCAPTURE CentreEndpoint: http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl +
URI: http://mobycentral.icapture.ubc.ca/MOBY/Central
YESA curated public registry hosted at the iCAPTURE Centre, VancouverPolicy
IRRI PhilippinesEndpoint: http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl
+ URI: http://cropwiki.irri.org/MOBY/Central
YESThe MOBY registry at the International Rice Research Institute +(IRRI) is intended mostly for Generation Challenge Program (GCP) +developers. It allows the registration of experimental moby entities +within GCP.Policy
+ From gordonp at dev.open-bio.org Tue Jan 23 19:36:26 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 23 Jan 2007 14:36:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701231936.l0NJaQAX025804@dev.open-bio.org> gordonp Tue Jan 23 14:36:25 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv25769/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java Log Message: Made DOM-built composites handle HAS children nicely moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 23:15:58 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/01/23 19:36:25 1.11 @@ -35,8 +35,6 @@ this(MobyDataType.getDataType(element.getLocalName()), getName(element), getNamespace(element), getId(element)); // Decompose the children - ConcurrentHashMap children = new ConcurrentHashMap(); - //HashMap children = new HashMap(); org.w3c.dom.NodeList substructures = MobyPrefixResolver.getChildElements(element, "*"); //wildcard int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ @@ -56,13 +54,10 @@ " does not have an article " + "name, which is required"); } - - // TODO, must deal with 1-to-many HAS relationship - children.put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); + + put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); } } - - putAll(children); } public MobyDataComposite(MobyDataType type, String name, MobyNamespace namespace, String id){ From mwilkinson at dev.open-bio.org Wed Jan 24 22:56:55 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 24 Jan 2007 17:56:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701242256.l0OMut6t029298@dev.open-bio.org> mwilkinson Wed Jan 24 17:56:55 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv29279/MOBY/Client Modified Files: Service.pm Log Message: silencing error on runnign test suite moby-live/Perl/MOBY/Client Service.pm,1.29,1.30 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 16:16:41 1.29 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2007/01/24 22:56:55 1.30 @@ -111,6 +111,8 @@ } } my $wsdl = $self->service; + return undef unless $wsdl; + if ($wsdl =~ //){ $self->category('post'); } @@ -125,7 +127,6 @@ # ________________________________________ $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug - return undef unless $wsdl; my $soap = SOAP::Lite->service( "data:,$wsdl" ); if ( $self->uri ) { $soap->uri( $self->uri ) } $self->serviceName( &_getServiceName( $soap ) ); From mwilkinson at dev.open-bio.org Wed Jan 24 22:56:55 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 24 Jan 2007 17:56:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701242256.l0OMutX8029316@dev.open-bio.org> mwilkinson Wed Jan 24 17:56:55 EST 2007 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv29279/t Modified Files: Client-Service.t Log Message: silencing error on runnign test suite moby-live/Perl/t Client-Service.t,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Service.t,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Perl/t/Client-Service.t 2005/11/22 20:05:00 1.8 +++ /home/repository/moby/moby-live/Perl/t/Client-Service.t 2007/01/24 22:56:55 1.9 @@ -62,7 +62,7 @@ my ($s, $err) = $C->findService( authURI => 'test.suite.com', name => 'myfirstservice' ); ok($s) or diag("Couldn't retrieve service details from MOBY Central"); -ok($$s[0]) or diag("no service instance found for getDragonLocusAlleles"); +ok($$s[0]) or diag("Just registered service, but not found on findService"); my $wsdl = $C->retrieveService($$s[0]); ok($wsdl =~ /WSDL/) or diag("retrieveService didn't return a WSDL file"); $service = MOBY::Client::Service->new (service => $wsdl); @@ -76,6 +76,6 @@ # Empty WSDL should cause 'undef' to be returned, rather than empty Service object. my $emptyWSDL = ""; is(MOBY::Client::Service->new ( service => $emptyWSDL), undef) - or diag("Expected new to return MOBY::Client::Service"); + or diag("Expected new to return undef when passed empty WSDL file"); From mwilkinson at dev.open-bio.org Thu Jan 25 16:38:58 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 11:38:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251638.l0PGcwt4031139@dev.open-bio.org> mwilkinson Thu Jan 25 11:38:58 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31120/MOBY/Client Modified Files: Central.pm Log Message: allow software using MOBY::Client::Central to declare its name as the User Agent such that we can keep track of it in the logs moby-live/Perl/MOBY/Client Central.pm,1.137,1.138 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.137 retrieving revision 1.138 diff -u -r1.137 -r1.138 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/14 17:57:06 1.137 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 16:38:58 1.138 @@ -90,7 +90,8 @@ MOBY_URI (default http://mobycentral.cbr.nrc.ca/MOBY/Central) MOBY_PROXY (no default) - Args : Registries - optional. + Args : user_agent - optional. The name of your software application + Registries - optional. - takes the form {$NAME1 => { URL => $URL, @@ -152,6 +153,8 @@ default_MOBY_type => [ 'soap', 'read/write' ], Registries => [ undef, 'read/write' ], multiple_registries => [ undef, 'read/write' ], + user_agent => [ "MOBY-Client-Central", 'read/write'], + # SWITCH TO THESE FOR A LOCAL MOBY CENTRAL REGISTRY #default_MOBY_server => ['http://localhost/cgi-bin/MOBY-Central.pl', 'read/write'], @@ -217,6 +220,7 @@ #print STDERR "executing CGI call\n"; use LWP::UserAgent; my $ua = LWP::UserAgent->new; + $ua->agent($self->user_agent); use CGI; $param =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg; my $paramstring = "?action=$method"; From mwilkinson at dev.open-bio.org Thu Jan 25 17:00:18 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:00:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251700.l0PH0Irp031233@dev.open-bio.org> mwilkinson Thu Jan 25 12:00:18 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31214/MOBY/Client Modified Files: Central.pm Log Message: allow software using MOBY::Client::Central to declare its name as the User Agent such that we can keep track of it in the logs moby-live/Perl/MOBY/Client Central.pm,1.138,1.139 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.138 retrieving revision 1.139 diff -u -r1.138 -r1.139 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 16:38:58 1.138 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 17:00:18 1.139 @@ -284,7 +284,7 @@ else { my @soapargs; if ($proxy) { - @soapargs = ( $url, proxy => [ 'http' => $proxy ] ); + @soapargs = ( $url, proxy => [ 'http' => $proxy ], user_agent => $self->user_agent, ); } else { @soapargs = ($url); From mwilkinson at dev.open-bio.org Thu Jan 25 17:12:14 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:12:14 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251712.l0PHCEq1031315@dev.open-bio.org> mwilkinson Thu Jan 25 12:12:14 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv31296/MOBY Modified Files: Central.pm Log Message: more changes for User Agent reporting moby-live/Perl/MOBY Central.pm,1.269,1.270 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.269 retrieving revision 1.270 diff -u -r1.269 -r1.270 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/17 19:58:44 1.269 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/25 17:12:14 1.270 @@ -36,6 +36,7 @@ #use RDF::Core::Constants qw(:xml :rdf :rdfs); use MOBY::MobyXMLConstants; my $debug = 0; +my %user_agent_args = (agent => "MOBY-Central-Perl"); if ($debug) { open( OUT, ">/tmp/CentralRegistryLogOut.txt" ) || die "cant open logfile\n"; @@ -1430,7 +1431,7 @@ sub _getServiceInstanceRDF { my ( %args ) = @_; - my $browser = LWP::UserAgent->new; + my $browser = LWP::UserAgent->new(%user_agent_args); my $conf = MOBY::Config->new(); return "" unless $conf->{mobycentral}->{rdf_generator}; my $url = URI->new( $conf->{mobycentral}->{rdf_generator} ); From mwilkinson at dev.open-bio.org Thu Jan 25 17:12:15 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:12:15 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251712.l0PHCFVO031335@dev.open-bio.org> mwilkinson Thu Jan 25 12:12:14 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31296/MOBY/Client Modified Files: OntologyServer.pm Log Message: more changes for User Agent reporting moby-live/Perl/MOBY/Client OntologyServer.pm,1.15,1.16 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2005/11/22 21:33:23 1.15 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:12:14 1.16 @@ -76,6 +76,8 @@ use vars qw($AUTOLOAD); use LWP::UserAgent; my $debug = 0; +my %user_agent_args = (agent => "MOBY-OntologyServer-Perl"); + { #Encapsulated class data @@ -208,7 +210,7 @@ sub getUserAgent { my ( $self, @args ) = @_; - my $ua = LWP::UserAgent->new; + my $ua = LWP::UserAgent->new(%user_agent_args); my $proxy = $ENV{MOBY_PROXY} if $ENV{MOBY_PROXY}; # first check the environment $proxy = $self->proxy From mwilkinson at dev.open-bio.org Thu Jan 25 17:15:13 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 25 Jan 2007 12:15:13 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701251715.l0PHFDRL031418@dev.open-bio.org> mwilkinson Thu Jan 25 12:15:13 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv31399/MOBY/Client Modified Files: OntologyServer.pm Log Message: more changes for User Agent reporting moby-live/Perl/MOBY/Client OntologyServer.pm,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:12:14 1.16 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:15:13 1.17 @@ -76,7 +76,7 @@ use vars qw($AUTOLOAD); use LWP::UserAgent; my $debug = 0; -my %user_agent_args = (agent => "MOBY-OntologyServer-Perl"); +my $user_agent = "MOBY-OntologyServer-Perl"; { @@ -210,7 +210,8 @@ sub getUserAgent { my ( $self, @args ) = @_; - my $ua = LWP::UserAgent->new(%user_agent_args); + my $ua = LWP::UserAgent->new(); + $ua->agent($user_agent); my $proxy = $ENV{MOBY_PROXY} if $ENV{MOBY_PROXY}; # first check the environment $proxy = $self->proxy From kawas at dev.open-bio.org Fri Jan 26 21:50:00 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 16:50:00 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262150.l0QLo03f001752@dev.open-bio.org> kawas Fri Jan 26 16:49:59 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1715/Client Modified Files: Central.pm Log Message: user-agent update (tested on soaplite .69) moby-live/Perl/MOBY/Client Central.pm,1.139,1.140 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.139 retrieving revision 1.140 diff -u -r1.139 -r1.140 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/25 17:00:18 1.139 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 21:49:59 1.140 @@ -292,7 +292,7 @@ push @{ $self->Connections }, [ $name, $type, - SOAP::Lite->proxy(@soapargs)->uri($uri)->on_fault( + SOAP::Lite->proxy(@soapargs, agent=>$self->user_agent )->uri($uri)->on_fault( sub { my ( $soap, $res ) = @_; die ref $res @@ -339,7 +339,7 @@ [ $self->default_MOBY_servername, $self->default_MOBY_type, - SOAP::Lite->proxy(@soapargs)->uri( $self->default_MOBY_uri ) + SOAP::Lite->proxy(@soapargs, agent=>$self->user_agent )->uri( $self->default_MOBY_uri ) ->on_fault( sub { my ( $soap, $res ) = @_; From mwilkinson at dev.open-bio.org Fri Jan 26 23:32:32 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 26 Jan 2007 18:32:32 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262332.l0QNWWOb002193@dev.open-bio.org> mwilkinson Fri Jan 26 18:32:32 EST 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv2174 Modified Files: MobyCentralObjects.html Log Message: updating docs for async moby-live/Docs/MOBY-S_API MobyCentralObjects.html,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2006/12/08 15:15:05 1.8 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2007/01/26 23:32:32 1.9 @@ -201,7 +201,7 @@ Ontology_Term </serviceType> <authoritative>1</authoritative> - <Category>moby</Category> <!-- 'moby' or 'cgi' or 'soap' --> + <Category>moby</Category> <!-- 'moby' or 'moby-async' or 'post' --> <Description><![CDATA[free text description here]]></Description> <contactEmail>your at email.addy.here</contactEmail> <URL>http://service.endpoint.here/scriptname</URL> From mwilkinson at dev.open-bio.org Fri Jan 26 23:46:26 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 26 Jan 2007 18:46:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262346.l0QNkQla002253@dev.open-bio.org> mwilkinson Fri Jan 26 18:46:26 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv2234/MOBY/Client Modified Files: Central.pm Log Message: removing default 'moby' service category from findService call moby-live/Perl/MOBY/Client Central.pm,1.140,1.141 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.140 retrieving revision 1.141 diff -u -r1.140 -r1.141 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 21:49:59 1.140 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 23:46:26 1.141 @@ -978,7 +978,7 @@ my $authoritative = $a{'authoritative'} || 0; my $serviceType = $a{'serviceType'} || ""; my $authURI = $a{'authURI'} || ""; - my $category = $a{'category'} || "moby"; + my $category = $a{'category'} || ""; my $exObj = $a{'expandObjects'} || 0; my $exServ = $a{'expandServices'} || 0; my $kw = $a{'keywords'} || []; From mwilkinson at dev.open-bio.org Fri Jan 26 23:46:26 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 26 Jan 2007 18:46:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701262346.l0QNkQTJ002273@dev.open-bio.org> mwilkinson Fri Jan 26 18:46:26 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv2234/MOBY Modified Files: Central.pm Log Message: removing default 'moby' service category from findService call moby-live/Perl/MOBY Central.pm,1.270,1.271 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.270 retrieving revision 1.271 diff -u -r1.270 -r1.271 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/25 17:12:14 1.270 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/26 23:46:26 1.271 @@ -2051,7 +2051,7 @@ ++$valid_service_ids{$_}; # increment that particular id's count by one } } - $findme{category} = 'moby' unless $findme{category}; + if ( $findme{category} ) { ++$criterion_count; $debug From kawas at dev.open-bio.org Sat Jan 27 00:14:55 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:14:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270014.l0R0EtNH002397@dev.open-bio.org> kawas Fri Jan 26 19:14:55 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder In directory dev.open-bio.org:/tmp/cvs-serv2362/Java/src/main/org/biomoby/client/rdf/builder Modified Files: ServiceInstanceRDF.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/client/rdf/builder ServiceInstanceRDF.java,1.33,1.34 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2006/10/25 02:33:23 1.33 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/rdf/builder/ServiceInstanceRDF.java 2007/01/27 00:14:55 1.34 @@ -2,10 +2,7 @@ import java.io.BufferedReader; import java.io.ByteArrayOutputStream; -import java.io.FilterOutputStream; -import java.io.IOException; import java.io.InputStreamReader; -import java.io.OutputStream; import java.net.URL; import java.util.HashMap; import java.util.Map; @@ -34,7 +31,6 @@ import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.RDF; import com.ibm.lsid.LSID; -import com.ibm.lsid.LSIDException; import com.ibm.lsid.MalformedLSIDException; /* @@ -223,6 +219,7 @@ } // set up the query service service = new MobyService(serviceName); + service.setCategory(""); service.setAuthority(domain); // query for the service try { @@ -254,6 +251,7 @@ // set up the query service service = new MobyService(); service.setAuthority(domain); + service.setCategory(""); // query for the service try { services = central.findService(service); @@ -308,6 +306,7 @@ // set up the query service service = new MobyService(serviceName); service.setAuthority(domain); + service.setCategory(""); // query for the service try { services = central.findService(service); @@ -338,6 +337,7 @@ // set up the query service service = new MobyService(); service.setAuthority(domain); + service.setCategory(""); // query for the service try { services = central.findService(service); @@ -376,6 +376,7 @@ } // set up the query service service = new MobyService(""); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -454,6 +455,7 @@ } // set up the query service service = new MobyService(""); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -495,6 +497,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -537,6 +540,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(URI); // query for the service try { @@ -1018,6 +1022,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(uri); // query for the service try { @@ -1040,6 +1045,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(uri); // service.setLSID(lsid); // query for the service @@ -1068,6 +1074,7 @@ } // set up the query service service = new MobyService(name); + service.setCategory(""); service.setAuthority(uri); // query for the service try { @@ -1081,25 +1088,4 @@ } return ""; } - - /** - * - * Usage: ServiceInstanceRDF authorityURI [serviceName] - *

- * authorityURI: is the authortitys' domain to query - *

- * serviceName: optional argument that identifies a specific service - * instance - *

- * - * @throws LSIDException - */ - public final static void main(String[] args) throws Exception { - // log.info(findService("bioinfo.inibap.org","Get_TropGENE_Distance_Matrix", - // false)); - // log.info(findService("bioinfo.icapture.ubc.ca","MOBYSHoundGetGenBankGFF", - // false)); - log.info(findService("blah.blah.blah", "Echo_test", "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", "http://bioinfo.icapture.ubc.ca/MOBY/Central", false)); - // log.info(findService("", "", false)); - } } From kawas at dev.open-bio.org Sat Jan 27 00:16:04 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:16:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270016.l0R0G4Fp002444@dev.open-bio.org> kawas Fri Jan 26 19:16:04 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory dev.open-bio.org:/tmp/cvs-serv2405/Java/src/main/org/biomoby/registry/rdfagent/verifier Modified Files: Processor.java Main.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Processor.java,1.30,1.31 Main.java,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2006/10/06 17:47:33 1.30 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Processor.java 2007/01/27 00:16:04 1.31 @@ -328,14 +328,18 @@ try { MobyService[] registryServices = new MobyService[] { new MobyService() }; // set the signature url to be the url + registryServices[0].setCategory(""); registryServices[0].setSignatureURL(url); registryServices = central.findService(registryServices[0]); + // FIXME search for async and post se + if (registryServices == null) throw new MobyException("Findservice call failed."); registryCount = registryServices.length; for (int i = 0; i < registryServices.length; i++) { foundServices.put(registryServices[i].getUniqueName(), registryServices[i]); } + } catch (MobyException e) { // Log.exception(this.getClass().getName(), "processServicesFromURL(String, Central)", e); @@ -393,6 +397,7 @@ Log.info("Unable to find a service in the registry that matches (" + rdfService.getUniqueName() + ")."); MobyService[] ms = new MobyService[] { new MobyService(rdfService.getName()) }; + ms[0].setCategory(""); ms[0].setAuthority(rdfService.getAuthority()); try { @@ -759,9 +764,12 @@ processCentralAdminCode(code); if (service.getEmailContact().trim().equals("")) { try { - MobyService[] services = central.findService(new MobyService(service.getName())); + MobyService __template__ = new MobyService(service.getName()); + __template__.setCategory(""); + MobyService[] services = central.findService(__template__); if (services == null || services.length < 1) { MobyService temp = new MobyService(); + temp.setCategory(""); temp.setAuthority(service.getAuthority()); services = central.findService(temp); if (services == null || services.length < 1) { @@ -794,9 +802,12 @@ } else { if (service.getEmailContact().trim().equals("")) { try { - MobyService[] services = central.findService(new MobyService(service.getName())); + MobyService __template__ = new MobyService(service.getName()); + __template__.setCategory(""); + MobyService[] services = central.findService(__template__); if (services == null || services.length < 1) { MobyService temp = new MobyService(); + temp.setCategory(""); temp.setAuthority(service.getAuthority()); services = central.findService(temp); if (services == null || services.length < 1) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2006/10/04 18:43:53 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2007/01/27 00:16:04 1.20 @@ -219,7 +219,10 @@ MobyService[] services = null; try { Log.info("Getting all services from the registry. Will take some time."); - services = central.findService(new MobyService()); + MobyService __template__ = new MobyService(); + __template__.setCategory(""); + services = central.findService(__template__); + __template__ = null; Log.info("Successfully retrieved all services from the registry."); } catch (MobyException e) { Log.exception("org.registry.rdfagent.verifier.Main", "processRegistry()", e.getCause()); From kawas at dev.open-bio.org Sat Jan 27 00:17:09 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:17:09 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270017.l0R0H936002520@dev.open-bio.org> kawas Fri Jan 26 19:17:09 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util In directory dev.open-bio.org:/tmp/cvs-serv2485/Java/src/main/org/biomoby/registry/rdfagent/util Modified Files: SignatureURLConnection.java Log Message: set the user agent for the agent moby-live/Java/src/main/org/biomoby/registry/rdfagent/util SignatureURLConnection.java,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2006/10/06 16:39:20 1.14 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java 2007/01/27 00:17:09 1.15 @@ -59,6 +59,7 @@ try { Log.info("Opening a connection to the url"); urlConnection = (HttpURLConnection) new URL(url).openConnection(); + urlConnection.setRequestProperty("User-Agent", "RDFAgent/1.0"); urlConnection.setDefaultUseCaches(false); urlConnection.setUseCaches(false); From kawas at dev.open-bio.org Sat Jan 27 00:20:45 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:20:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270020.l0R0KjrR002653@dev.open-bio.org> kawas Fri Jan 26 19:20:45 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities In directory dev.open-bio.org:/tmp/cvs-serv2618/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities Modified Files: ServiceTester.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities ServiceTester.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2006/10/25 19:32:54 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2007/01/27 00:20:45 1.10 @@ -62,7 +62,7 @@ public MobyService[] getServices() { MobyService[] services = null; MobyService template = new MobyService(); - + template.setCategory(""); try { Central central = new CentralImpl(url, uri); services = central.findService(template); @@ -340,6 +340,7 @@ // MOST likely a newly added service MobyService s = new MobyService(servicename); s.setAuthority(authority); + s.setCategory(""); try { Central central = new CentralImpl(url, uri); if (central.findService(s).length > 0) @@ -353,6 +354,7 @@ // MOST likely a newly added service MobyService s = new MobyService(servicename); s.setAuthority(authority); + s.setCategory(""); try { Central central = new CentralImpl(url, uri); if (central.findService(s).length > 0) From kawas at dev.open-bio.org Sat Jan 27 00:22:55 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:22:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270022.l0R0Mt9D002696@dev.open-bio.org> kawas Fri Jan 26 19:22:55 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities In directory dev.open-bio.org:/tmp/cvs-serv2661/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities Modified Files: ServiceTester.java Log Message: set the user agent for the pinger moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities ServiceTester.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2007/01/27 00:20:45 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java 2007/01/27 00:22:55 1.11 @@ -7,6 +7,7 @@ import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; @@ -17,6 +18,7 @@ import org.apache.axis.AxisFault; import org.apache.axis.client.Call; import org.apache.axis.client.Service; +import org.apache.axis.transport.http.HTTPConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.log4j.Logger; @@ -384,6 +386,11 @@ Service service = new Service(); call = (Call) service.createCall(); call.setTargetEndpointAddress(endpoint); + // set the agent + Hashtable t = new Hashtable(); + t.put(HTTPConstants.HEADER_USER_AGENT, "MobyPinger/1.0"); + call.setProperty(HTTPConstants.REQUEST_HEADERS, t); + // wait at most 2 minutes call.setTimeout(new Integer(1000 * 60 * 3)); From kawas at dev.open-bio.org Sat Jan 27 00:31:09 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:31:09 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270031.l0R0V9L8002985@dev.open-bio.org> kawas Fri Jan 26 19:31:08 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms In directory dev.open-bio.org:/tmp/cvs-serv2946/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms Modified Files: RDFGenerator.java LSIDComplete.java Log Message: moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms RDFGenerator.java,1.5,1.6 LSIDComplete.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.java 2006/08/30 17:07:55 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.java 2007/01/27 00:31:08 1.6 @@ -20,8 +20,9 @@ * @author Eddie Kawas *

* Created for use by the Perl based moby central registry so that RDF - * documents for newly registered services can be generated. This servlet is most likely - * only called when a service has been registered. + * documents for newly registered services can be generated. This + * servlet is most likely only called when a service has been + * registered. *

* email me at edward.kawas at gmail.com */ @@ -34,18 +35,19 @@ final private String newline = System.getProperty("line.separator"); - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { String authority = filter(request.getParameter("auth")); String serviceName = filter(request.getParameter("name")); String endpoint = filter(request.getParameter("url")); String uri = filter(request.getParameter("uri")); - //System.out.println(endpoint + " " + authority + " " + uri + " " + serviceName); + // System.out.println(endpoint + " " + authority + " " + uri + " " + + // serviceName); // null endpoints or uri default to mobycentral endpoint = (endpoint == null) ? CentralImpl.DEFAULT_ENDPOINT : endpoint; uri = (uri == null) ? CentralImpl.DEFAULT_NAMESPACE : uri; - + if (serviceName == null || serviceName.equals("")) { // error routine here response.setContentType("text/html"); @@ -60,9 +62,9 @@ out.println("The service providers authority is missing"); return; } + response.setContentType("application/rdf+xml"); - response.setHeader("Content-Disposition", "attachment;filename=" - + "service.rdf"); + response.setHeader("Content-Disposition", "attachment;filename=" + "service.rdf"); PrintWriter out = response.getWriter(); out.print(ServiceInstanceRDF.findService(authority, serviceName, endpoint, uri, false)); return; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.java 2006/10/11 01:54:50 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.java 2007/01/27 00:31:08 1.3 @@ -11,9 +11,9 @@ import java.util.Iterator; import java.util.Map; import java.util.Properties; -import java.util.Timer; -import java.util.TimerTask; + +import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -21,10 +21,8 @@ import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.discovery.tools.DiscoverSingleton; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.biomoby.client.ui.graphical.servlet.utilities.ContextLoader; import org.biomoby.registry.properties.MobyProperties; /* @@ -50,26 +48,8 @@ private Map datas = Collections.synchronizedMap(new HashMap()); - public void init() throws ServletException { + public void init(ServletConfig conf) throws ServletException { super.init(); - - - ContextLoader cLoader = null; - try { - cLoader = (ContextLoader) DiscoverSingleton.find(Class - .forName((String) ContextLoader.class.getCanonicalName()), Class.forName( - (String) ContextLoader.class.getCanonicalName()).getName()); - log - .warn((cLoader == null ? "ContextLoader is null and is therefore not loaded. This is BAD!" - : "ContextLoader has loaded successfully.")); - } catch (Exception e) { - log.warn("ContextLoader is null and is therefore not loaded. This is BAD!" - + System.getProperty("line.separator") + e.getStackTrace()); - } - - log.debug("Initializing the Timer that will invoke the StatWriter"); - Timer timer = new Timer(); - timer.scheduleAtFixedRate(new StatWriter(this), new java.util.Date(), 1000 * 60 * 60); } // an array of properties objects created initialized once for more efficient running @@ -331,8 +311,10 @@ continue; BasicDataSource bds = (BasicDataSource) ds; log.info("NumActive connections to " + object + ": " + bds.getNumActive()); - log.info("NumIdle: connections to " + object + ": " + bds.getNumIdle()); + log.info("NumIdle: connections to " + object + ": " + bds.getNumIdle()); + shutdownDataSource(bds); } + map.clear(); } public void shutdownDataSource(DataSource ds) throws SQLException { @@ -340,22 +322,4 @@ bds.close(); ds = null; } - - private class StatWriter extends TimerTask { - private LSIDComplete lc = null; - - public StatWriter(LSIDComplete lc) { - this.lc = lc; - } - - public void run() { - log.debug("Attempting to invoke StatWriter"); - try { - printDataSourceStats(lc.datas); - } catch (SQLException e) { - log.error("Error invoking the StatWriter " + e.getLocalizedMessage()); - } - } - - } } \ No newline at end of file From kawas at dev.open-bio.org Sat Jan 27 00:32:30 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:32:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270032.l0R0WUe0003061@dev.open-bio.org> kawas Fri Jan 26 19:32:30 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv3026/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority Modified Files: MobyAuthority.java Log Message: include signatureURLs for services as a source for metadata moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority MobyAuthority.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/10/19 21:25:25 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2007/01/27 00:32:30 1.10 @@ -117,6 +117,7 @@ : System.getProperty("MOBY_URI"))); MobyService service = new MobyService(parts[1]); service.setAuthority(parts[0]); + service.setCategory(""); MobyService[] services = central.findService(service); if (services.length == 1) if (services[0].getSignatureURL() != null From kawas at dev.open-bio.org Sat Jan 27 00:34:07 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 26 Jan 2007 19:34:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701270034.l0R0Y7BI003140@dev.open-bio.org> kawas Fri Jan 26 19:34:06 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources In directory dev.open-bio.org:/tmp/cvs-serv3105/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources Modified Files: RESOURCE.java Log Message: when doing findservice, i set the category to "" moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources RESOURCE.java,1.24,1.25 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2006/10/16 17:23:16 1.24 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/jresources/RESOURCE.java 2007/01/27 00:34:06 1.25 @@ -389,7 +389,9 @@ // exists central = new CentralImpl(); } - services = central.findService(new MobyService("")); + MobyService __service__ = new MobyService(); + __service__.setCategory(""); + services = central.findService(__service__); } catch (MobyException e) { log.error("Exception thrown: " + e.getMessage()); } From mwilkinson at dev.open-bio.org Tue Jan 30 00:16:25 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:16:25 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300016.l0U0GP0x032532@dev.open-bio.org> mwilkinson Mon Jan 29 19:16:25 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv32513/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.271,1.272 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.271 retrieving revision 1.272 diff -u -r1.271 -r1.272 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/26 23:46:26 1.271 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:16:25 1.272 @@ -2193,6 +2193,17 @@ ++$valid_service_ids{$_}; } } + + unless ($criterion_count){ # in case all criterion are null, find everything + my $ids = _extract_ids($adaptor->query_service_instance(category => "%" )); + unless ( scalar @{$ids} ) { + return &_serviceListResponse( undef ); + } + foreach ( @{$ids} ) { + $debug && &_LOG("found service_instance_id $_\n"); + ++$valid_service_ids{$_}; # increment that particular id's count by one + } + } my @final; while ( my ( $id, $freq ) = each %valid_service_ids ) { $debug From mwilkinson at dev.open-bio.org Tue Jan 30 00:26:18 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:26:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300026.l0U0QIcB032610@dev.open-bio.org> mwilkinson Mon Jan 29 19:26:18 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory dev.open-bio.org:/tmp/cvs-serv32571/MOBY/Adaptor/moby/queryapi Modified Files: mysql.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.80,1.81 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/22 20:56:34 1.80 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/30 00:26:18 1.81 @@ -121,19 +121,19 @@ for my $key (keys %pair) { - if (defined $pair{$key}) - { - #added a check for servicename to support case sensitivity - if ($key eq "servicename") { - $condition .= $key . " LIKE binary ? "; - } else { - $condition .= $key . " = ? "; - } - push(@bindvalues, $pair{$key}); - } - else - { - $condition .= $key . " IS NULL " + if (defined $pair{$key}){ + #added a check for servicename to support case sensitivity + if ($key eq "servicename") { + $condition .= $key . " LIKE binary ? "; + push(@bindvalues, $pair{$key}); + } elsif ($pair{$key} eq "IS NOT NULL"){ + $condition .= $key . " IS NOT NULL "; + } else { + $condition .= $key . " = ? "; + push(@bindvalues, $pair{$key}); + } + } else{ + $condition .= $key . " IS NULL " } } } From mwilkinson at dev.open-bio.org Tue Jan 30 00:26:18 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:26:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300026.l0U0QIdR032590@dev.open-bio.org> mwilkinson Mon Jan 29 19:26:18 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv32571/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.272,1.273 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.272 retrieving revision 1.273 diff -u -r1.272 -r1.273 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:16:25 1.272 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:26:18 1.273 @@ -2195,7 +2195,7 @@ } unless ($criterion_count){ # in case all criterion are null, find everything - my $ids = _extract_ids($adaptor->query_service_instance(category => "%" )); + my $ids = _extract_ids($adaptor->query_service_instance(category => "IS NOT NULL" )); unless ( scalar @{$ids} ) { return &_serviceListResponse( undef ); } From mwilkinson at dev.open-bio.org Tue Jan 30 00:32:54 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:32:54 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300032.l0U0Ws1m032670@dev.open-bio.org> mwilkinson Mon Jan 29 19:32:54 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv32651/MOBY/Client Modified Files: Central.pm Log Message: remove default value of authoritative for MOBY::Client::Service moby-live/Perl/MOBY/Client Central.pm,1.141,1.142 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.141 retrieving revision 1.142 diff -u -r1.141 -r1.142 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/26 23:46:26 1.141 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/30 00:32:54 1.142 @@ -975,7 +975,7 @@ my $reg = ( $a{Registry} ) ? $a{Registry} : $self->default_MOBY_servername; my $id = $a{'serviceID'}; my $servicename = $a{'serviceName'} || ""; - my $authoritative = $a{'authoritative'} || 0; + my $authoritative = $a{'authoritative'} || ""; my $serviceType = $a{'serviceType'} || ""; my $authURI = $a{'authURI'} || ""; my $category = $a{'category'} || ""; From mwilkinson at dev.open-bio.org Tue Jan 30 00:41:30 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:41:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300041.l0U0fUo5032748@dev.open-bio.org> mwilkinson Mon Jan 29 19:41:29 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv32729/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.273,1.274 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.273 retrieving revision 1.274 diff -u -r1.273 -r1.274 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:26:18 1.273 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:41:29 1.274 @@ -2193,8 +2193,10 @@ ++$valid_service_ids{$_}; } } - +print STDERR "Criterion Count was $criterion_count\n"; unless ($criterion_count){ # in case all criterion are null, find everything + ++$criterion_count; # this is an AWFUL hack. We need to add a criterion in order for teh next while loop to be successful in finding each of these services. This is really really terrible, but it works until someone tries to "fix" something... + my $ids = _extract_ids($adaptor->query_service_instance(category => "IS NOT NULL" )); unless ( scalar @{$ids} ) { return &_serviceListResponse( undef ); From mwilkinson at dev.open-bio.org Tue Jan 30 00:42:45 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 29 Jan 2007 19:42:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701300042.l0U0gjUj000339@dev.open-bio.org> mwilkinson Mon Jan 29 19:42:45 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv320/MOBY Modified Files: Central.pm Log Message: adding behaviour to return all services if no criterion are passed to findService moby-live/Perl/MOBY Central.pm,1.274,1.275 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.274 retrieving revision 1.275 diff -u -r1.274 -r1.275 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:41:29 1.274 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:42:45 1.275 @@ -2193,7 +2193,6 @@ ++$valid_service_ids{$_}; } } -print STDERR "Criterion Count was $criterion_count\n"; unless ($criterion_count){ # in case all criterion are null, find everything ++$criterion_count; # this is an AWFUL hack. We need to add a criterion in order for teh next while loop to be successful in finding each of these services. This is really really terrible, but it works until someone tries to "fix" something... From d.haase at dev.open-bio.org Tue Jan 30 14:34:18 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:34:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301434.l0UEYIqv001634@dev.open-bio.org> d.haase Tue Jan 30 09:34:17 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv1599 Modified Files: Central.pm Log Message: Changed Relationships such that it can process both directions ('root' and 'leaves'). 'leaves' direction was not possible yet. moby-live/Perl/MOBY Central.pm,1.275,1.276 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.275 retrieving revision 1.276 diff -u -r1.275 -r1.276 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:42:45 1.275 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 14:34:17 1.276 @@ -2928,14 +2928,22 @@ Returns : output XML (see below) Args : Input XML (see below). Notes : expandRelationships behaviour - - for ISA relationships means traverse to root - - for HAS and HASA means traverse ISA to root and - grab all HAS or HASA's along the way + - for ISA relationships means traverse to root/leaves + - for HAS and HASA means traverse ISA to root/leaves and + for each node in the ISA hierarchy return the HAS/HASA + relationship partners, where 'root' matches container objects + and 'leaves' matches contained objects. + Example: suppose a relationship "objA HAS objB", + a) if query is objectType=>objA, direction=>'root', relationship=>'HAS', + then objB is in result set + b) if query is objectType=>objB, direction=>'leaves', relationship=>'HAS', + then objA is in result set input XML : $term 1|0 + root|leaves $relationship_term ... more relationship types ... @@ -2944,6 +2952,7 @@ $term 1|0 + root|leaves $relationship_term ... more relationship types ... @@ -2988,9 +2997,20 @@ my $expand_relationship = &_nodeTextContent( $doc, 'expandRelationship' ); $expand_relationship =~ s/\s//g; $expand_relationship ||= 0; + + + # find out direction: + my $direction = &_nodeTextContent( $doc, "direction" ); + $direction = 'root' unless $direction; # make root default to stay compatible + # it has to be either 'leaves' or 'root' + $direction = ($direction eq 'leaves') ? 'leaves' : 'root'; + + my %reltypes; my $relationship; + + for ( my $n = 1 ; $n <= $l ; ++$n ) { my @child = $x->get_node($n)->childNodes; foreach (@child) { @@ -3027,7 +3047,7 @@ term => $term, expand => $expand_relationship, relationship => $relationship, - direction => 'root' + direction => $direction, )}); # %relationships_found = $rels{relationship_lsid} = [lsid, lsid,lsid] } From kawas at dev.open-bio.org Tue Jan 30 14:37:19 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 30 Jan 2007 09:37:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301437.l0UEbJN2001798@dev.open-bio.org> kawas Tue Jan 30 09:37:19 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv1763 Modified Files: CommonSubs.pm Log Message: getExceptions wasnt working properly if the attributes were prefixed moby. moby-live/Perl/MOBY CommonSubs.pm,1.91,1.92 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2006/06/07 20:35:22 1.91 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2007/01/30 14:37:19 1.92 @@ -803,9 +803,9 @@ foreach my $n ( 1 .. ( $responses->size() ) ) { my $except={}; my $resp = $responses->get_node( $n ); - $except->{refElement}=$resp->getAttribute("refElement"); - $except->{refQueryID}=$resp->getAttribute("refQueryID"); - $except->{severity}=$resp->getAttribute("severity"); + $except->{refElement}=$resp->getAttribute("refElement") | $resp->getAttribute("moby:refElement"); + $except->{refQueryID}=$resp->getAttribute("refQueryID") | $resp->getAttribute("moby:refQueryID"); + $except->{severity}=$resp->getAttribute("severity") | $resp->getAttribute("moby:severity"); foreach my $child ($resp->childNodes) { if ($child->toString=~/exceptionCode>(.+)<\//) {$except->{exceptionCode}=$1}; if($child->toString=~/exceptionMessage>(.+)<\//) {$except->{exceptionMessage}=$1}; From d.haase at dev.open-bio.org Tue Jan 30 14:37:44 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:37:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301437.l0UEbiQU001827@dev.open-bio.org> d.haase Tue Jan 30 09:37:44 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1743 Modified Files: Central.pm Log Message: Added optional argument 'direction' to allow for querying 'leaves' direction. Also extended the query XML by new tag . moby-live/Perl/MOBY/Client Central.pm,1.142,1.143 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.142 retrieving revision 1.143 diff -u -r1.142 -r1.143 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/30 00:32:54 1.142 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/01/30 14:37:44 1.143 @@ -1723,6 +1723,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) expandRelationships => [1/0] (optional) + direction => ['root'/'leaves'] (optional) =cut @@ -1733,6 +1734,9 @@ my $expand = $args{'expandRelationships'}; $expand = $args{'expandRelationship'} unless defined($expand); # be forgiving of typos + my $direction = $args{'direction'} ? + $args{'direction'} : + 'root'; # make 'root' default to stay compatible my @relationships; @relationships = @{ $args{'Relationships'} } if ( $args{'Relationships'} @@ -1751,6 +1755,7 @@ $m .= "$_\n"; } $m .= "1\n" if $expand; + $m .= "$direction\n"; $m .= ""; $reg = $reg ? $reg : $self->default_MOBY_servername; return undef unless ( $self->Connection($reg) ); @@ -1766,6 +1771,7 @@ $m .= "$_\n"; } $m .= "1\n" if $expand; + $m .= "$direction\n"; $m .= ""; $reg = $reg ? $reg : $self->default_MOBY_servername; return undef unless ( $self->Connection($reg) ); @@ -1776,7 +1782,6 @@ return &_relationshipsPayload($payload); } - sub _relationshipsPayload { my ($payload) = @_; return undef unless $payload; From d.haase at dev.open-bio.org Tue Jan 30 14:49:20 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:49:20 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301449.l0UEnK4B001939@dev.open-bio.org> d.haase Tue Jan 30 09:49:20 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv1900 Modified Files: OntologyServer.pm Log Message: Re-implementation of methods Relationships and traverseDAG; reduces DB interaction and enables expansion to 'leaves' direction in Relationships; traverseDAG now uses Relationships call internally. moby-live/Perl/MOBY OntologyServer.pm,1.101,1.102 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2006/03/23 18:00:50 1.101 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2007/01/30 14:49:20 1.102 @@ -63,6 +63,7 @@ =cut package MOBY::OntologyServer; + use strict; use Carp; use vars qw($AUTOLOAD); @@ -1253,122 +1254,232 @@ =cut sub Relationships { - - # this entire subroutine assumes that there is NOT multiple parenting!! - my ( $self, %args ) = @_; - my $ontology = $args{ontology} ? $args{ontology} : $self->ontology; - - my $results; - if ( $ontology eq 'service' ) { - $results = &_ServiceRelationships($self, %args); - } elsif ( $ontology eq 'object' ) { - $results = &_ObjectRelationships($self, %args); - } else { - return {[]}; - } - return $results; -} - -sub _ServiceRelationships { - my ($self, %args) = @_; - my %results = []; - my $term = $args{term}; - my $relationship = $args{relationship}; - my $direction = $args{direction} ? $args{direction} : 'root'; - my $expand = $args{expand} ? 1 : 0; - my $ontology = "service"; - return \%results unless ($term); - - $term = $self->getServiceURI($term); - $relationship ||="isa"; - my $OS = MOBY::OntologyServer->new(ontology => 'relationship'); - $relationship = $OS->getRelationshipURI("service", $relationship); - - while ($term && (!($term =~ /urn\:lsid\:biomoby.org\:servicetype\:Service\:/ ) )){ - my $defs = $self->_doRelationshipsQuery($ontology,$term,$relationship,$direction ); - next unless $defs; # somethig has gone terribly wrong! - my $lsid; - my $rel; - my $articleName; - foreach ( @{$defs} ) { - $lsid = $_->[0]; - $rel = $_->[1]; - $articleName = $_->[2]; - $articleName ||=""; - my $info = $self->serviceInfo(term => $lsid); # we need to get the term name, and that doesn't come from here - my $term = $info->{service_type}; - push @{ $results{$rel} }, {lsid => $lsid, term => $term}; - } - last unless ($expand); - last unless ( $direction eq "root" ); # if we aren't going to root, then be careful or we'll loop infnitely - $term = $lsid; # this entire subroutine assumes that there is NOT multiple parenting... - } - - return \%results; -} - -sub _ObjectRelationships { - my ($self, %args) = @_; - my %results = []; - my $term = $args{term}; - my $relationship = $args{relationship}; - my $direction = $args{direction} ? $args{direction} : 'root'; - my $expand = $args{expand} ? 1 : 0; - my $ontology = 'object'; - return \%results unless ($term); - $term = $self->getObjectURI($term); - $relationship ||="isa"; - my $OS = MOBY::OntologyServer->new(ontology => 'relationship'); - $relationship = $OS->getRelationshipURI("object", $relationship); - my $isa_relationship = $OS->getRelationshipURI("object", "ISA"); - return \%results unless $isa_relationship; # we need this to do the isa traversal to root when expanding the hasa and has relationships call - - my @isa_hierarchy = ($term); - while ($term && (!($term =~ /urn\:lsid\:biomoby.org\:servicetype\:Object\:/ ) )){ # first build the entire ISA hierarchy - my $defs = $self->_doRelationshipsQuery($ontology,$term,$isa_relationship,$direction ); - next unless $defs; # somethig has gone terribly wrong! - my $lsid; - my $def = shift @{$defs}; # for ISA there should be only one parent - $lsid = $def->[0]; # the lsid is in slot 0 - push @isa_hierarchy, $lsid if $lsid; - $term = $lsid; # this entire subroutine assumes that there is NOT multiple parenting... - } - foreach my $node(@isa_hierarchy){ # now traverse along the ISA hierarchy and get what you need - my $defs = $self->_doRelationshipsQuery($ontology,$node,$relationship,$direction ); - next unless $defs; # somethig has gone terribly wrong! - my $lsid; - my $rel; - my $articleName; - foreach ( @{$defs} ) { - next unless $_->[0]; - $lsid = $_->[0]; - $rel = $_->[1]; - $articleName = $_->[2]; - $articleName ||=""; - my $info = $self->objectInfo(term => $lsid); # we need to get the term name, and that doesn't come from here - my $term = $info->{object_type}; - push @{ $results{$rel} }, {lsid => $lsid, articleName => $articleName, term => $term}; - } - last unless ($expand); - last unless ( $direction eq "root" ); # if we aren't going to root, then be careful or we'll loop infnitely - $term = $lsid; # this entire subroutine assumes that there is NOT multiple parenting... - } - return \%results; -} - -sub _doRelationshipsQuery { - my ( $self, $ontology, $term, $relationship, $direction ) = @_; - $CONFIG ||= MOBY::Config->new; # exported by Config.pm - my $datasource = "moby$ontology"; # like mobyobject, or mobyservice - my $adaptor = $CONFIG->getDataAdaptor( datasource => $datasource ); - my $defs; - # query returns a reference to an array containing array references - $defs = $adaptor->get_relationship(direction => $direction, - ontology => $ontology, - term => $term, - relationship => $relationship); - # a very long piece of SQL statements have been refactored into Moby::Adaptor::moby::queryapi::mysql.pm - return $defs; + my ($self, %args) = @_; + my %results; + + my $term = $args{term}; + my $ontology = $args{ontology} ? $args{ontology} : $self->ontology; + my $direction = $args{direction} ? $args{direction} : 'root'; + $direction = $direction eq 'root'? 'root' : 'leaves'; # map anything else to 'leaves' + my $relationship = $args{relationship}; + my $expand = $args{expand} ? 1 : 0; + + # in order to make this function also usable for 'traverseDAG' + # we need a more precise definition what to expand. Note that + # the default settings assure the behaviour of the old 'expand' param. + # 1. expand along the isa relationship? + my $isaExpand = $args{isaExpand} ? $args{isaExpand} : $expand; + # 2. expand along the inclusion relationship types (has/hasa), + # i.e. get inclusions of inclusions? + # (Note: this is set when called by 'traverseDAG') + my $incExpand = $args{incExpand} ? $args{incExpand} : 0; + # 3. explore inclusion relationships for complete isa hierarchy? + # (Note: this was fix behaviour of the old 'expand', + # but is not used by traverseDAG) + my $mapIncToIsa = $args{mapIncToIsa} ? $args{mapIncToIsa} : $expand; + + # first of all, get ID of query entity, + # internally, we will operate on pure IDs + # as long as possible... + $CONFIG ||= MOBY::Config->new; # exported by Config.pm + my $datasource = "moby$ontology"; # like mobyobject, or mobyservice + my $adaptor = $CONFIG->getDataAdaptor( datasource => $datasource ); + my $queryId; + my $query_method = "query_$ontology"; + my $result = $adaptor->$query_method(type => $term); + my $row = shift @$result; + $queryId = $row->{"${ontology}_id"}; + + return {} unless $queryId; + + # get all relationships in the database in one query + my $relHash = $adaptor->get_all_relationships(direction=>$direction,ontology=>$ontology); + + # find out which relationships to return + # use keys of %$relHash, because these are lsids: + + # initialize to return all relationships (becomes effective if eg. 'all' was used) + my @relList = keys %$relHash; + if ( (not $relationship) or # ISA (and nothing else) is the default if nothing specified + ($relationship =~ /isa$/i) ) { + @relList = grep { /isa$/i } @relList; + } + elsif ( $relationship =~ /has(a)?$/i ) { + # if either has or hasa was specified, use only that + @relList = grep { /$relationship$/i } @relList; + } + + # build the isa hierarchy, it's needed in any case... + my ($isaLsid) = grep { /isa$/i } keys %$relHash; # we need the lsid... + my $isa_hierarchy = $self->_getIsaHierarchy($relHash->{$isaLsid}, $queryId, $direction, $isaExpand); + + # prepare the hash for storing HAS/HASA relationship details + my $hasRelDetails; + + # table fields needed to get entity details: + my @fields = ("${ontology}_lsid","${ontology}_type"); + + # nodes to check for has/hasa relationship + my @checkNodes = ($queryId); + # mapIncToIsa means that has/hasa has to be checked + # not only for the query object alone but also for all + # isa ancestors/descendants + push @checkNodes, @$isa_hierarchy if $mapIncToIsa; + + # the result hash will consist of one list for each included relationship type... + foreach my $rel ( @relList ) { + my @entityQueryList = (); # this collects the unique object ids + my @entityResultList = (); # this collects ids of objects to add to the result, maybe not unique + # the latter one is not essential to have, the only benefit is + # a somehow predictable order in the output... + + # find out which entities we have to include in the result + # and how these are related to each other; + # Note: all needed information is present in the relationship hash %$relHash! + + if ( $rel ne $isaLsid ) { + # either HAS or HASA + foreach my $node ( @checkNodes ) { + my $incls = $self->_getInclusions($relHash,$node,[$rel], $incExpand); + foreach my $triplet ( @$incls ) { + my ($inclId, $inclArtName, $inclAssert) = @$triplet; + $hasRelDetails->{$inclId}->{$inclAssert} = $inclArtName; + push @entityResultList, $inclId; + } + } + # set up list of unique object ids for the database lookup + @entityQueryList = keys %$hasRelDetails; + } + else { + # ISA + @entityQueryList = @$isa_hierarchy; # isa hierarchy is guaranteed to be unique... + @entityResultList = @$isa_hierarchy; # ... but still both variables have to be set + } + + # now it's time to move away from pure ids, retrieve details from database: + my $details = $adaptor->get_details_for_id_list($ontology, \@fields, \@entityQueryList); + + # enhance details with information about relationships and build result hash + foreach my $entityId (@entityResultList) { + # add articleName slot if necessary + if ( exists $hasRelDetails->{$entityId} ) { + foreach my $assert ( keys %{$hasRelDetails->{$entityId}} ) { + $details->{$entityId}->{'articleName'} = $hasRelDetails->{$entityId}->{$assert}; + } + } + elsif ( $ontology eq 'object') { + # for isa, articleName is the empty string + $details->{$entityId}->{'articleName'} = ''; + } + + # map ontology specific field names to commons slots: + # 1. 'object_lsid'/'service_lsid' -> 'lsid' + $details->{$entityId}->{'lsid'} = $details->{$entityId}->{"${ontology}_lsid"} + unless exists $details->{$entityId}->{'lsid'}; # do just once foreach object! + delete $details->{$entityId}->{"${ontology}_lsid"}; # remove redundant slot + # 2. 'object_type'/'service_type' -> 'term' + $details->{$entityId}->{'term'} = $details->{$entityId}->{"${ontology}_type"} + unless exists $details->{$entityId}->{'term'}; # do just once foreach object! + delete $details->{$entityId}->{"${ontology}_type"}; # remove redundant slot + + # finally, add record to the result hash + push @{ $results{$rel} }, $details->{$entityId}; + } + } + return \%results; +} + +sub _getIsaHierarchy { + # Finds out the isa hierarchy for the query entity, that is + # the parent (the one which it inherits from) if direction is 'root' or + # the children (one or more which inherit from it) if direction is 'leaves'. + # If 'expand' is set all deeper levels (ancestors or descendants if you like) + # are also included. + # Note 1: this implementation relies on pure single inheritance! + # Note 2: we can use the same method for both directions only because the + # provided isaHash is built with the direction in mind, make sure + # to have direction consistent! + + # returned is a reference to a flat list + + my ($self, $isaHash, $query, $direction, $expand) = @_; + + my @hierarchy = (); + if ( exists $isaHash->{$query} ) { + if ( $direction eq 'root' ) { + # push the parent entity + push @hierarchy, $isaHash->{$query}; # relies on single inheritance! + } + elsif ( $direction eq 'leaves' ) { + # push the direct children + push @hierarchy, @{$isaHash->{$query}}; + } + else { + # it has to be either 'root' or 'leaves' + warn "_getIsaHierarchy was called with wrong direction indicator, + use either 'root' or 'leaves'!\n"; + return []; + } + if ( $expand ) { + my @firstLevel = @hierarchy; + foreach my $entity ( @firstLevel ) { + my $deeperLevels = $self->_getIsaHierarchy($isaHash, $entity, $direction, 1); + push @hierarchy, @$deeperLevels; + } + } + return \@hierarchy; + } + else { + # important: anchor the recursion! + return []; + } +} + +sub _getInclusions { + + # Finds out the objects related to the query by one of the inclusion + # relationships (HAS or HASA). This is the HAS/HASA-analogue to + # _getIsaHierarchy, but is more complicated, because the values in + # the provided relationship hash ($relHash) are not simple ids but + # triplets ("relationship records") in the format of: + # [id of relationship partner, articleName, assertion id] + # On the other hand, direction does not matter here, because + # we have to deal with multi relationships in any case. + # Like for ISA, be aware that the relationship hash '$relHash' + # is built direction dependant. Make sure to use it consistently! + + # Note: third argument is a listref of relationship types, that is + # it could be called with HAS and HASA (expected are lsids) at + # the same time and in this way merge both inclusion relationship + # types. However, this usage is not used currently and not tested! + + # Returned is a reference to a list with each element being + # a triplet (listref to a relationship record) as explained above. + + my ($self, $relHash, $query, $relList, $expand) = @_; + + my %nodeCheckDone; # for avoiding multiple check of one node (if expand is set) + my @allInclusions = (); + foreach my $relType ( @$relList ) { + # 'root' means: include all relationships where query is the + # containing (outer) object; + # eg. if A HAS B, and A is query, include this record + if ( exists $relHash->{$relType}->{$query} ) { + my $relRecords = $relHash->{$relType}->{$query}; + foreach my $record ( @$relRecords ) { + push @allInclusions, $record; + if ( $expand ) { + my ($incId, $artName, $assert) = @$record; + if ( not exists $nodeCheckDone{$incId} ) { + my $deeperInclusions = $self->_getInclusions($relHash, $incId, $relList, 1); + push @allInclusions, @$deeperInclusions; + $nodeCheckDone{$incId}++; + } + } + } + } + } + return \@allInclusions; # empty if nothing found, this anchors the recursion } =head2 setURI @@ -1402,73 +1513,40 @@ =cut sub traverseDAG { - my ( $self, $term, $direction ) = @_; - my $ontology = $self->ontology; - return {} unless $ontology; - return {} unless $term; - $direction = "root" unless ($direction); - return {} unless ( ( $direction eq 'root' ) || ( $direction eq 'leaves' ) ); - if ( $ontology eq 'service' ) { - $term = $self->getServiceURI($term); - } elsif ( $ontology eq 'object' ) { - $term = $self->getObjectURI($term); - } - return {} unless $term =~ /^urn\:lsid/; # now its a URI - my $relhash = $self->getRelationshipTypes( ontology => $ontology ); # get teh types of relationships for the object/service ontology - return {} unless $relhash; - my @rels = keys %{$relhash}; #@rels is the list of relationship types for that ontology - my %relationships; - foreach my $relationship (@rels) { - my %IDS; - my $OS = MOBY::OntologyServer->new( ontology => 'relationship' ); - my $reluri = - $OS->getRelationshipURI( $ontology, $relationship ) - ; # get the URI for that relationship type if it ins't already a URI - $IDS{$term} = "untestedroot"; # mark the one in-hand as being untested - while ( grep /untested/, ( values %IDS ) ) - { # now, while there are untested services in our list... - foreach my $termthingy ( keys %IDS ) - { # start parsing through the current list (hash keys) - $debug && _LOG("testing $relationship of $termthingy\n"); - next - if ( $IDS{$termthingy} eq "tested" ) - ; # if it has been tested already then move on - my $lsids = $self->Relationships( - term => $termthingy, - relationship => $relationship, - direction => $direction - ) - ; # get the related terms for this type; this should return a single hash value - if ( $IDS{$termthingy} =~ /root/ ) - { # here is where we remove self - delete $IDS{$termthingy}; - $debug && _LOG("deleting $termthingy\n"); - } else { - $debug && _LOG("marking $termthingy as TESTED\n"); - $IDS{$termthingy} = - "tested"; # mark the current one as now being "done" - } - - #${$lsids}{relationshiptype}=[lsid, lsid, lsid]; - foreach my $lsid_article ( @{ $lsids->{$relationship} } ) - { # go through the related terms - my $lsid = $lsid_article->{lsid}, - my $article = $lsid_article->{articleName}; - $debug && _LOG("found $lsid as relationship"); - next - if ( defined $IDS{$lsid} ) - ; # if we have already seen that term, skip it - $debug && _LOG("setting $lsid as untested\n"); - $IDS{$lsid} = - "untested" # otherwise add it to the list and loop again. - } - } - } - my @IDS = keys %IDS; - $relationships{$relationship} = - \@IDS; # and associate them all with the current relationship type - } - return \%relationships; + my ( $self, $term, $direction ) = @_; + my $ontology = $self->ontology; + return {} unless $ontology; + return {} unless $term; + $direction = "root" unless ($direction); + return {} unless ( ( $direction eq 'root' ) || ( $direction eq 'leaves' ) ); + if ( $ontology eq 'service' ) { + $term = $self->getServiceURI($term); + } elsif ( $ontology eq 'object' ) { + $term = $self->getObjectURI($term); + } + return {} unless $term; # search term not in db! + return {} unless $term =~ /^urn\:lsid/; # now its a URI + + my $result = {}; + # get the types of relationships for the object/service ontology + my $relTypeHash = $self->getRelationshipTypes( ontology => $ontology ); + my $relHash = $self->Relationships( term => $term, + direction => $direction, + ontology => $ontology, + isaExpand => 1, + incExpand => 1, + mapIncToIsa => 0, + relationship => 'all'); + foreach my $relType ( keys %$relTypeHash ) { + $result->{$relType} = []; + my %tmpHash; # avoid doubles! + my $relList = $relHash->{$relType}; + foreach my $rel ( @$relList ) { + $tmpHash{$rel->{'lsid'}}++; + } + @{$result->{$relType}} = keys %tmpHash; + } + return $result; } sub _LOG { From d.haase at dev.open-bio.org Tue Jan 30 14:57:47 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 09:57:47 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301457.l0UEvlmS002046@dev.open-bio.org> d.haase Tue Jan 30 09:57:47 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby In directory dev.open-bio.org:/tmp/cvs-serv2011 Modified Files: queryapi.pm Log Message: Added interfaces for new methods 'get_all_relationships' and 'get_details_for_id_list' moby-live/Perl/MOBY/Adaptor/moby queryapi.pm,1.31,1.32 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/11/20 15:45:35 1.31 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2007/01/30 14:57:47 1.32 @@ -1308,11 +1308,75 @@ die "get_relationship not implemented in adaptor\n"; } +=head2 get_all_relationships + + Title : get_all_relationships + Usage : my $un = $API->get_all_relationships(%args) + Function : Execute a query for all relationships represented in $ontology_term2term + Args : direction => String - direction in the ontology (either 'root' or 'leaves') + ontology => String - name of the table ontology + Returns : reference to hash with the following structure: + $resultHash->{String relationship_type}->{Integer key_entity_id} = + The structure of depends on relationship_type and direction: + HAS/HASA : + = @([Integer value_entity_id, String articleName, Integer assertion_id]) + ISA, leaves : + = @(Integer value_entity_id) + ISA, root : + = Integer value_entity_id + Notes : The hash is built 'direction-aware', that is for + - root : key_entity_id = ${ontology}1_id, value_entity_id = ${ontology}2_id + - leaves: key_entity_id = ${ontology}2_id, value_entity_id = ${ontology}1_id + The structure of the result hash is a bit complex because it is specifically + designed for usage by MOBY::OntolgyServer::Relationships + The result hash contains the entire table ${ontology}_term2term in order to + reduce DB interaction in the ontology exploration + +=cut + +# Get all relationships in the queried database in one go. The +# complete table ${ontology}_term2term is transferred into a hash +# whose reference is finally returned. Important: note that the hash +# is built 'direction aware', that is for objects 'object1_id' is used +# as key when direction is 'root' and 'object2_id' as value. Vice +# versa for the 'leaves' direction. Likewise for services. +# Returns a hash reference. +sub get_all_relationships{ + die "get_all_relationships not implemented in adaptor\n"; +} + +=head2 get_deails_for_id_list + + Title : get_deails_for_id_list + Usage : my $un = $API->get_all_relationships($ontology, $field_list, $id_list) + Function : Retrieve details specified in @$field_list from $ontology for ids in @$id_list + Args : $ontology => String - name of the table ontology + $field_list => Reference to array of Strings representing table fields in $ontology + $id_list => Reference to array of Integers representing ${ontology}_ids + Returns : reference to hash with the following structure: + $resultHash->{Integer ${ontology}_id}->{String field_name} = field_value + Notes : This function is generic with respect to which details (fields) are retrieved, but + is restricted to those tables whose name is identical to the ontology name (i.e. + currently 'object', 'service', 'namespace' and 'relationship') + Makes use of the 'select ... from ... where ... in ()' statement syntax + in order to reduce the number of DB interactions + Used in MOBY::OntologyServer::Relationships, but maybe useful for other purposes... + +=cut + +# retrieve details for a number of entities from table $ontology +# represented by a list of ${ontology}_id's; +# used in MOBY::OntologyServer::Relationships +sub get_details_for_id_list { + die "get_details_for_id_list not implemented in adaptor\n"; +} + + # Not quite sure what this does... sub _checkURI { die "_checkURI not implemented in adaptor\n"; } - + sub _dump { my ($self) = @_; foreach my $attrname ( $self->_standard_keys ) { From d.haase at dev.open-bio.org Tue Jan 30 15:08:33 2007 From: d.haase at dev.open-bio.org (Dirk Haase) Date: Tue, 30 Jan 2007 10:08:33 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701301508.l0UF8Xoj002218@dev.open-bio.org> d.haase Tue Jan 30 10:08:33 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory dev.open-bio.org:/tmp/cvs-serv2183 Modified Files: mysql.pm Log Message: Added new methods for usage in MOBY::OntologyServer::Relationships: get_all_relationships and get_details_for_id_list. Also fixed a bug in get_relationship (select statement for 'leaves' direction), but I guess this method isn't used any longer due to re-implementation of MOBY::OntologyServer::Relationships anyway... moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.81,1.82 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/30 00:26:18 1.81 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2007/01/30 15:08:33 1.82 @@ -1371,7 +1371,7 @@ } else { unless ( defined $relationship ) { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from + select distinct s1.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 @@ -1381,7 +1381,7 @@ s2.${ontology}_lsid = ?", undef, $lsid); # ") } else { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid $extra_columns from + select distinct s1.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 @@ -1395,6 +1395,93 @@ return $defs; } +# Get all relationships in the queried database in one go. The +# complete table ${ontology}_term2term is transferred into a hash +# whose reference is finally returned. Important: note that the hash +# is built 'direction aware', that is for objects 'object1_id' is used +# as key when direction is 'root' and 'object2_id' as value. Vice +# versa for the 'leaves' direction. Likewise for services. +# Returns a hash reference. +sub get_all_relationships { + + my ($self, %args) = @_; + my $direction = $args{'direction'}; + my $ontology = $args{'ontology'}; + # my $relationship = $args{'relationship'}; # has to be lsid! + + my $relHash; + my $dbh = _getDBHandle("moby$ontology"); + + my $statement = "select ${ontology}1_id, ${ontology}2_id, relationship_type"; + $statement .= ", object2_articlename, assertion_id " if $ontology eq 'object'; + $statement .= " from ${ontology}_term2term"; + # my $relationship_lsid = "urn:lsid:biomoby.org:${ontology}relation:isa"; + my $defs = $dbh->selectall_arrayref($statement); + + return {} unless @$defs; + foreach my $def (@$defs) { + my $relationship = $def->[2]; + if ( $relationship =~ /has/i ) { + # HAS or HASA + # >1 has/hasa child possible; also store articlename and assertion_id + # hash structure: $relHash->{has/a-lsid}->{object1_id}->[object2_id,articlename,assertion_id] + push @{$relHash->{$relationship}->{$def->[0]}}, [$def->[1],$def->[3],$def->[4]] if $direction eq 'root'; + push @{$relHash->{$relationship}->{$def->[1]}}, [$def->[0],$def->[3],$def->[4]] if $direction eq 'leaves'; + } + elsif ( $relationship =~ /isa/i ) { + # ISA + push @{$relHash->{$relationship}->{$def->[1]}}, $def->[0] if $direction eq 'leaves'; # >1 child possible! + $relHash->{$relationship}->{$def->[0]} = $def->[1] if $direction eq 'root'; # no multi parents! + } + else { return {}; } + } + return $relHash; +} + +# retrieve details for a number of entities from table $ontology +# represented by a list of ${ontology}_id's; +# used in MOBY::OntologyServer::Relationships +sub get_details_for_id_list { + my ($self, $ontology, $fields, $idList) = @_; + + return {} unless @$idList; + return {} unless @$fields; + + my $dbh = _getDBHandle("moby$ontology"); + my $result = {}; + + # avoid errors due to wrong field names: + my %existingFields; + my @queryFields = (); + my $resArray = $dbh->selectall_arrayref("SHOW COLUMNS FROM $ontology"); + foreach my $row ( @$resArray ) { + $existingFields{$row->[0]}++; + } + foreach my $field ( @$fields ) { + next if $field eq "${ontology}_id"; + if ( exists $existingFields{$field} ) { + push @queryFields, $field; + } + else { + warn "Requested field $field does not exist in table $ontology!"; + } + } + + # + my $statement = "select ${ontology}_id, ". join(",", @queryFields). + " from $ontology where ${ontology}_id in (" . + join(",", @$idList) . ")"; + $resArray = $dbh->selectall_arrayref($statement); + foreach my $row ( @$resArray ) { + my $entityId = shift @$row; + foreach my $field (@queryFields) { + my $value = shift @$row; + $result->{$entityId}->{$field} = $value ? $value : ''; + } + } + return $result; +} + sub _checkURI { # my $uri = "http://www.ics.uci.edu/pub/ietf/uri/#Related"; From mwilkinson at dev.open-bio.org Tue Jan 30 22:50:52 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Tue, 30 Jan 2007 17:50:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701302250.l0UMoqVW003562@dev.open-bio.org> mwilkinson Tue Jan 30 17:50:52 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv3543/MOBY Modified Files: CommonSubs.pm Log Message: not a bitwise comparison moby-live/Perl/MOBY CommonSubs.pm,1.92,1.93 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2007/01/30 14:37:19 1.92 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2007/01/30 22:50:52 1.93 @@ -803,9 +803,9 @@ foreach my $n ( 1 .. ( $responses->size() ) ) { my $except={}; my $resp = $responses->get_node( $n ); - $except->{refElement}=$resp->getAttribute("refElement") | $resp->getAttribute("moby:refElement"); - $except->{refQueryID}=$resp->getAttribute("refQueryID") | $resp->getAttribute("moby:refQueryID"); - $except->{severity}=$resp->getAttribute("severity") | $resp->getAttribute("moby:severity"); + $except->{refElement}=$resp->getAttribute("refElement") || $resp->getAttribute("moby:refElement"); + $except->{refQueryID}=$resp->getAttribute("refQueryID") || $resp->getAttribute("moby:refQueryID"); + $except->{severity}=$resp->getAttribute("severity") || $resp->getAttribute("moby:severity"); foreach my $child ($resp->childNodes) { if ($child->toString=~/exceptionCode>(.+)<\//) {$except->{exceptionCode}=$1}; if($child->toString=~/exceptionMessage>(.+)<\//) {$except->{exceptionMessage}=$1}; From kawas at dev.open-bio.org Wed Jan 31 16:17:43 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 31 Jan 2007 11:17:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200701311617.l0VGHhHt007397@dev.open-bio.org> kawas Wed Jan 31 11:17:43 EST 2007 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv7362 Modified Files: Client-OntologyServer.t Log Message: rub1 wasnt beening removed at the end of the test moby-live/Perl/t Client-OntologyServer.t,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2005/12/19 20:08:44 1.7 +++ /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2007/01/31 16:17:43 1.8 @@ -1,179 +1,182 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' - -# Note added by Frank Gibbons. -# Tests should, as far as possible, avoid the use of literals. -# If you register a service with authURI => mysite.com, -# and you want to test a retrieved description of the service, -# don't test that the service returns authURI eq "mysite.com", -# test so that it returns the same value as you used to register it in the first place. - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; -#use SOAP::Lite +trace; -use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details -use strict; -use MOBY::Client::OntologyServer; -use MOBY::Client::Central; -BEGIN { use_ok('MOBY::Client::OntologyServer'); - # initialize with a couple of useless things that we can guarantee to find - my $C = MOBY::Client::Central->new(); - - my %Namespace = ( namespaceType => 'Rub1', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - my $r = $C->registerNamespace( %Namespace ); - %Namespace = ( namespaceType => 'Rub2', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - $r = $C->registerNamespace( %Namespace ); - my %ServiceType = ( serviceType => "Rub1", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType ); - %ServiceType = ( serviceType => "Rub2", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType );}; - -END { - # Define cleanup of registry, to return it to its 'pristine' state, - # so that later attempts to run tests don't run into problems caused - # by failure of these tests, or abortion of the test script. - # Reconnect to MOBY Central here, since other connections - # will have gone out of scope by the time we get to this END block. - # Also can't use %Obj, - my $C = MOBY::Client::Central->new(); - my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); - $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); - $r = $C->deregisterServiceType( serviceType => 'Rub2' ); - $r = $C->deregisterServiceType( serviceType => 'Rub2' ); -}; - - -my @autoload = qw/host proxy/; -my @API = (@autoload, qw/new getUserAgent -objectExists serviceExists namespaceExists /); - -my $os = MOBY::Client::OntologyServer->new(); - -if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { - print STDERR <host,"\n\n\n"; -} - -foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. -can_ok("MOBY::Client::OntologyServer", @API) - or diag("OntologyServer doesn't implement full API"); - -# Check that accessor methods work correctly; -my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); -my ($new_host, $new_proxy) = ("foo.cgi", "bar"); -is($os->host($new_host), $new_host) or diag("Couldn't set new host"); -is($os->host(), $new_host) or diag("Couldn't get host"); -is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); - is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); - is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); -TODO: { - local $TODO = "How come I cant' set proxy back to its original value?"; - is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); -} - -# Start fresh.... -$os = MOBY::Client::OntologyServer->new(); - -my ($success, $msg, $existingURI); -my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid -foreach (@check_ns) { - ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); - is($success, 1) - or diag("Namespace '$_' reported erroneously as non-existent."); -} - -# Could get these allowed datatypes from MOBY::Config, -# except that module only works when you've got a local registry set up. -my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid -foreach (@check_obj) { - ($success, $msg, $existingURI) = $os->objectExists(term => $_); - is($success, 1) - or diag("Object '$_' reported erroneously as non-existent."); -} - -my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... -foreach (@check_servicetype) { - ($success, $msg, $existingURI) = $os->serviceExists(term => $_); - is($success, 1) - or diag("Service type '$_' reported erroneously as non-existent."); -} - -SKIP: { - skip "relationshipExists not implemented", 5 - unless MOBY::Client::OntologyServer->can("relationshipExists"); - - can_ok("MOBY::Client::OntologyServer", "relationshipExists") - or diag("OntologyServer should be able to tell whether a relationship exists"); - my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. - foreach (@check_rel) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. - foreach (@check_rel2) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - - my $invalid_rel = "HA"; - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); -} - - -######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### -# -# Literal invalid names are OK here, since there's no obvious way to generate them -# and guarantee that they'll be invalid. -# -my $invalid_ns = "InvalidNS"; -($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); -is($success, 0) - or diag("Namespace '$invalid_ns' reported erroneously as existent."); - -my $invalid_obj = "InvalidObject"; -($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); -is($success, 0) - or diag("Object '$invalid_obj' reported erroneously as existent."); - -my $invalid_st = "InvalidServiceType"; -($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); -is($success, 0) - or diag("Service type '$invalid_st' reported erroneously as existent."); - +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 1.t' + +# Note added by Frank Gibbons. +# Tests should, as far as possible, avoid the use of literals. +# If you register a service with authURI => mysite.com, +# and you want to test a retrieved description of the service, +# don't test that the service returns authURI eq "mysite.com", +# test so that it returns the same value as you used to register it in the first place. + +######################### + +# change 'tests => 1' to 'tests => last_test_to_print'; +#use SOAP::Lite +trace; +use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details +use strict; +use MOBY::Client::OntologyServer; +use MOBY::Client::Central; +BEGIN { use_ok('MOBY::Client::OntologyServer'); + # initialize with a couple of useless things that we can guarantee to find + my $C = MOBY::Client::Central->new(); + + my %Namespace = ( namespaceType => 'Rub1', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + my $r = $C->registerNamespace( %Namespace ); + %Namespace = ( namespaceType => 'Rub2', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + $r = $C->registerNamespace( %Namespace ); + my %ServiceType = ( serviceType => "Rub1", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + %ServiceType = ( serviceType => "Rub2", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + }; + + +END { + # Define cleanup of registry, to return it to its 'pristine' state, + # so that later attempts to run tests don't run into problems caused + # by failure of these tests, or abortion of the test script. + # Reconnect to MOBY Central here, since other connections + # will have gone out of scope by the time we get to this END block. + # Also can't use %Obj, + my $C = MOBY::Client::Central->new(); + my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); + $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); + $r = $C->deregisterServiceType( serviceType => 'Rub1' ); + $r = $C->deregisterServiceType( serviceType => 'Rub2' ); + +}; + + +my @autoload = qw/host proxy/; +my @API = (@autoload, qw/new getUserAgent +objectExists serviceExists namespaceExists /); + +my $os = MOBY::Client::OntologyServer->new(); + +if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { + print STDERR <host,"\n\n\n"; +} + +foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. +can_ok("MOBY::Client::OntologyServer", @API) + or diag("OntologyServer doesn't implement full API"); + +# Check that accessor methods work correctly; +my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); +my ($new_host, $new_proxy) = ("foo.cgi", "bar"); +is($os->host($new_host), $new_host) or diag("Couldn't set new host"); +is($os->host(), $new_host) or diag("Couldn't get host"); +is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); + is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); + is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); +TODO: { + local $TODO = "How come I cant' set proxy back to its original value?"; + is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); +} + +# Start fresh.... +$os = MOBY::Client::OntologyServer->new(); + +my ($success, $msg, $existingURI); +my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid +foreach (@check_ns) { + ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); + is($success, 1) + or diag("Namespace '$_' reported erroneously as non-existent."); +} + +# Could get these allowed datatypes from MOBY::Config, +# except that module only works when you've got a local registry set up. +my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid +foreach (@check_obj) { + ($success, $msg, $existingURI) = $os->objectExists(term => $_); + is($success, 1) + or diag("Object '$_' reported erroneously as non-existent."); +} + +my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... +foreach (@check_servicetype) { + ($success, $msg, $existingURI) = $os->serviceExists(term => $_); + is($success, 1) + or diag("Service type '$_' reported erroneously as non-existent."); +} + +SKIP: { + skip "relationshipExists not implemented", 5 + unless MOBY::Client::OntologyServer->can("relationshipExists"); + + can_ok("MOBY::Client::OntologyServer", "relationshipExists") + or diag("OntologyServer should be able to tell whether a relationship exists"); + my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. + foreach (@check_rel) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. + foreach (@check_rel2) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + + my $invalid_rel = "HA"; + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); +} + + +######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### +# +# Literal invalid names are OK here, since there's no obvious way to generate them +# and guarantee that they'll be invalid. +# +my $invalid_ns = "InvalidNS"; +($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); +is($success, 0) + or diag("Namespace '$invalid_ns' reported erroneously as existent."); + +my $invalid_obj = "InvalidObject"; +($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); +is($success, 0) + or diag("Object '$invalid_obj' reported erroneously as existent."); + +my $invalid_st = "InvalidServiceType"; +($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); +is($success, 0) + or diag("Service type '$invalid_st' reported erroneously as existent."); +