From kawas at pub.open-bio.org Tue Aug 2 01:19:57 2005 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Tue Aug 2 02:06:42 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508020519.j725Jvsc031026@pub.open-bio.org> kawas Tue Aug 2 01:19:57 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv30997/org/biomoby/registry/rdfagent/verifier Modified Files: DataMngr.java ServiceDescrParser.java Log Message: Fixed the all the bugs detected by my driver, except for the ability to remove all inputs when no outputs exist when a secondary input exists. Ed moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier DataMngr.java,1.11,1.12 ServiceDescrParser.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/DataMngr.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/DataMngr.java 2005/07/29 22:19:05 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/DataMngr.java 2005/08/02 05:19:57 1.12 @@ -216,7 +216,7 @@ public static void processService(Hashtable servSign, Hashtable servInp, Hashtable servOut, String servname, String authURI, String signURL) { - + Connection con = DBConnector.getConnection(); String servName = ""; String cat = "moby"; @@ -333,30 +333,7 @@ || !authoritative.equals(signature.getAuthoritative()) || !authuri.equals(authURI)) { - //TODO - Log.info("Updating the service '" + servName - + "' since the RDF document has been modified."); if (signatureURL.equals("NNN")) { - Log.info("sig == NNN" + signURL); - Log - .info("=<" - + servName - + "," - + cat - + "," - + stype - + "," - + authuri - + "," - + url - + "," - + email - + "," - + desc - + "," - + authoritative - + "," - + signURL + ">"); int res = updSign(servName, cat, stype, authuri, url, email, desc, authoritative, signURL); if (res == 1) { @@ -372,7 +349,6 @@ } } else { - Log.info("sig != NNN"); int res = updSign(servName, cat, stype, authuri, url, email, desc, authoritative, signatureURL); if (res == 1) { @@ -412,10 +388,13 @@ if (delRow("simple_input", servInstId) == 1) dels = 1; } + + // check if there is at lease one simple input if (!servInp.containsKey("siminp1")) { if (delRow("simple_input", servInstId) == 1) dels = 1; } + // check if there is at least one collection input if (!servInp.containsKey("colinp1")) { delCollectionMember("input", servInstId); if (delRow("collection_input", servInstId) == 1) @@ -568,6 +547,8 @@ Report.doWrite("collection_input_id: " + colId); // Log.info("collection_input_id: "+colId); } + // TODO - made this change to clear the collection input id + colId = 0; } Report.doWrite("service_instance_id: " + servInstId); @@ -628,7 +609,6 @@ Report.doWrite("Simple output " + so); Report.add("Simple output " + so + ":"); - //TODO bug #13 here? if (delsout == 0) { delRow("simple_output", servInstId); // delete from // simple_output table @@ -652,23 +632,23 @@ if (col_art.equals(" ")) { col_art = null; } - } + } else if (ob1.equals("articleName")) { art = simple.get(ob1).toString(); if (art.equals(" ")) { art = null; } - } + } else if (ob1.equals("object_type_uri")) { obt = simple.get(ob1).toString(); - } + } else if (ob1.equals("namespace_type_uris")) { nst = simple.get(ob1).toString(); } } if (simcol.equals("colout")) { - + //TODO bug 36 here? insIntoCol("collection_output", col_art, servInstId); // insert // the row // into @@ -681,6 +661,7 @@ art = null; obt = null; nst = null; + col_art = null; } // TODO bug #11 here - fixed if (simcol.equals("simout")) { @@ -694,6 +675,7 @@ Report.doWrite("collection_output_id: " + colOutId); // Log.info("collection_output_id: "+coloutId); } + colOutId = null; } // return serv; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/ServiceDescrParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/ServiceDescrParser.java 2005/07/29 22:17:39 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/ServiceDescrParser.java 2005/08/02 05:19:57 1.9 @@ -377,6 +377,7 @@ | type.equals(RDF.Bag)) { // if (l3Res.hasProperty(RDF.type,RDF.Bag) && // l3Res.hasProperty(RDF.li(1))){ + if (l3Res.hasProperty(RDF.li(1))) { StmtIterator p34iter = l3Res.listProperties(); if (l3Res.hasProperty(MP.articleName)) { @@ -385,6 +386,8 @@ String[] rezNode = col_artName.split(":http:"); col_artName = rezNode[0]; colinp.put("col_articleName", col_artName); + } else if (colinp.containsKey("col_articleName")) { + colinp.remove("col_articleName"); } while (p34iter.hasNext()) { Statement l4iter = p34iter.nextStatement(); @@ -446,20 +449,21 @@ .toString()); colinp.put(name, lsid_nsp); } else if (name.equals("articleName")) { - colinp.put(name, l5Node.getName()); + colinp.put(name, rezNode[0]); }else { colinp.put(name, l5Node); } } - input.put("colinp" + cin, colinp); - cin += 1; + input.put("colinp" + cin++, colinp); Enumeration num = colinp.keys(); - String col_name = (String)colinp.get("col_articleName"); + String col_name = null; + if (colinp.containsKey("col_articleName")) + col_name = (String)colinp.get("col_articleName"); colinp = new Hashtable(); - colinp.put("col_articleName", col_name); + if (col_name != null) + colinp.put("col_articleName", col_name); } } - } } else { collection = "error"; @@ -647,6 +651,8 @@ String[] rezNode = col_artName.split(":http:"); col_artName = rezNode[0]; colout.put("col_articleName", col_artName); + } else if (colout.containsKey("col_articleName")) { + colout.remove("col_articleName"); } while (p34iter.hasNext()) { Statement l4iter = p34iter.nextStatement(); @@ -713,13 +719,14 @@ colout.put(name, l5Node); } } - //TODO BUG here. colout should be 'new' and not recycled - output.put("colout" + co, colout); - co += 1; - Enumeration num = colout.keys(); - String col_name = (String)colout.get("col_articleName"); + output.put("colout" + co++, colout); + Enumeration num = colout.keys(); //why? + String col_name = null; + if (colout.containsKey("col_articleName")) + col_name = (String)colout.get("col_articleName"); colout = new Hashtable(); - colout.put("col_articleName", col_name); + if (col_name != null) + colout.put("col_articleName", col_name); } } @@ -742,7 +749,6 @@ } catch (Exception e) { Log.warning("Failed (ServiceDescrParser.java-getOutput): " + e); } - //System.out.println("output = "+output); return output; } From mwilkinson at pub.open-bio.org Tue Aug 2 11:18:00 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 2 12:04:30 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508021518.j72FI0Hs000356@pub.open-bio.org> mwilkinson Tue Aug 2 11:18:00 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv310/t Modified Files: Client-Central.t Log Message: new API prevents inheritence from Primitives. This is now enforced by the registry. Added tests to ensure that this works. moby-live/Perl/t Client-Central.t,1.25,1.26 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/07/29 17:40:58 1.25 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/02 15:18:00 1.26 @@ -4,8 +4,8 @@ ######################### # change 'tests => 1' to 'tests => last_test_to_print'; -#use SOAP::Lite +trace; -use Test::More tests => 122; # perldoc Test::More for details +use SOAP::Lite +trace; +use Test::More tests => 123; # perldoc Test::More for details # Test 1 BEGIN { use_ok('MOBY::Client::Central') }; @@ -15,7 +15,8 @@ # Test 2 my $C = MOBY::Client::Central->new( Registries => { - mobycentral => { URL => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/MOBY-Central.pl', + mobycentral => { URL => +'http://localhost/cgi-bin/MOBY-Central.pl', URI => 'http://mobycentral.icapture.ubc.ca/MOBY/Central'} } ); @@ -29,7 +30,7 @@ ################## MOBY Registration Tests ################# -# Test 3 +# Test 3 inherits from two isas - should fail $r = $C->registerObjectClass(objectType => "Rubbish", description => "a human-readable description of the object", contactEmail => 'your@email.address', @@ -46,8 +47,25 @@ +# Test inherits from primitive type - should fail +$r = $C->registerObjectClass(objectType => "Rubbish", + description => "a human-readable description of the object", + contactEmail => 'your@email.address', + authURI => "test.suite.com", + Relationships => { + ISA => [ + ['String', 'article1'], + ], + HASA => [ + ['Object', 'articleName3']]} + ); +( ok(!$r->success,"Object registration correctly failed") + or diag("Object registration inheritence from primitive test failure: ".$r->message)); + + + -# Test 4 +# Test 4 should succeed $r = $C->registerObjectClass(objectType => "Rubbish", description => "a human-readable description of the object", contactEmail => 'your@email.address', @@ -133,7 +151,7 @@ -# Test 9 # should fail +# Test 9 # should fail due to datatype all caps $r = $C->registerService( serviceName => "myfirstservice", serviceType => "Retrieval", From mwilkinson at pub.open-bio.org Tue Aug 2 11:18:00 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 2 12:04:33 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508021518.j72FI0KZ000337@pub.open-bio.org> mwilkinson Tue Aug 2 11:18:00 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv310/MOBY Modified Files: Central.pm Config.pm OntologyServer.pm Log Message: new API prevents inheritence from Primitives. This is now enforced by the registry. Added tests to ensure that this works. moby-live/Perl/MOBY Central.pm,1.197,1.198 Config.pm,1.7,1.8 OntologyServer.pm,1.71,1.72 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.197 retrieving revision 1.198 diff -u -r1.197 -r1.198 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/07/29 18:58:44 1.197 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/02 15:18:00 1.198 @@ -267,16 +267,8 @@ my ( $success, $message ); my $OntologyServer = &_getOntologyServer( ontology => 'object' ); my $RelOntologyServer = &_getOntologyServer( ontology => 'relationship' ); - $debug - && &_LOG( -"\n\npayload\n**********************\n$payload\n***********************\n\n" - ); my ( $term, $desc, $relationships, $email, $auth, $clobber ) = &_registerObjectPayload($payload); - $debug - && &_LOG( -"\n\nterm $term\ndesc $desc\nemail $email\nauth $auth\nclobber $clobber\n\n" - ); unless ( defined $term && defined $desc && defined $auth && defined $email ) { @@ -349,6 +341,24 @@ ($success == 0) && return &_error( $message, $URI ); } } + + # now test if the object inherits from primitives... if so, abort + if ( keys %{$relationships} ) { + while ( my ( $reltype, $obj ) = each %{$relationships} ) { + next unless ($reltype =~ /isa/i); # we are only testing isa relationships here. + foreach ( @{$obj} ) { + my ( $objectType, $articleName ) = @{$_}; + if (&_testObjectTypeAgainstPrimitives($objectType)){ + return &_error( "Inheritance from Primitive data-types is now deprecated. You shold construct your object using a HASA relationship. for example, text-plain HASA string (as opposed to ISA string)", "" ); + } + } + } + } + + + # should be good to go now... + + ( $success, $message, $URI ) = $OntologyServer->createObject( node => $term, description => $desc, @@ -384,7 +394,7 @@ and may indicate corruption of the MOBY Central registry.", $deleteURI ); return &_error( -"object failed to register due to failure during registration of ISA/HASA relationships" +"object failed to register due to unexplained failure during registration of ISA/HASA relationships" . ( join ",", (@failures) ) . "\n", "" ); @@ -442,6 +452,17 @@ return ( $term, $desc, \%relationships, $email, $authURI, $clobber ); } +sub _testObjectTypeAgainstPrimitives{ + my ($type) = @_; + my $CONF = MOBY::Config->new; + my @primitives = @{$CONF->primitive_datatypes}; # get the list of known primitive datatypes + my $x = 0; # set flag down + map {($x=1) if ($type eq $_)} @primitives; # test primitives against this one + return $x; # return flag state +} + + + =head2 deregisterObjectClass =over 3 @@ -2867,7 +2888,7 @@ &_nodeTextContent( $doc, "serviceType" ); # if we didn't get anything using objectType try serviceType return undef unless $term; # and bail out if we didn't succeed $ontology ||= "service"; # if we have now succeeded and haven't already taken the ontology then it must be the service ontology - &_LOG("Ontology was $ontology; Term was $term\n"); + $debug && &_LOG("Ontology was $ontology; Term was $term\n"); my $OS = MOBY::OntologyServer->new( ontology => $ontology ); my %rels = %{ $OS->Relationships( term => $term, expand => $expand_relationship )}; # %rels = $rels{relationship} = [lsid, lsid,lsid] my $response = "\n"; @@ -3471,12 +3492,12 @@ sub _LOG { - #return unless $debug; + return unless $debug; #print join "\n", @_; #print "\n---\n"; #return; open LOG, ">>/tmp/CentralRegistryLogOut.txt" - or die "can't open logfile $!\n"; + or die "can't open mobycentral error logfile $!\n"; print LOG join "\n", @_; print LOG "\n---\n"; close LOG; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Config.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/Config.pm 2005/07/06 16:46:41 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/Config.pm 2005/08/02 15:18:00 1.8 @@ -23,6 +23,7 @@ mobyservice => [ undef, 'read/write' ], mobyrelationship => [ undef, 'read/write' ], valid_secondary_datatypes => [["String", "Integer", "DateTime", "Float"], 'read'], + primitive_datatypes => [["String", "Integer", "DateTime", "Float", "Boolean"], 'read'], ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/07/29 17:39:32 1.71 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/02 15:18:00 1.72 @@ -1062,6 +1062,7 @@ { my $defs = $self->_doRelationshipsQuery( $ontology, $term, $relationship, $direction ); + return {[]} unless $defs; # somethig has gone terribly wrong! my $lsid; my $rel; foreach ( @{$defs} ) { From dwang at pub.open-bio.org Tue Aug 2 20:28:20 2005 From: dwang at pub.open-bio.org (Dennis Wang) Date: Tue Aug 2 21:14:42 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508030028.j730SKXs001848@pub.open-bio.org> dwang Tue Aug 2 20:28:20 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby In directory pub.open-bio.org:/tmp/cvs-serv1822/Perl/MOBY/Adaptor/moby Modified Files: queryapi.pm Log Message: reviewed up to get_object_relationships moby-live/Perl/MOBY/Adaptor/moby queryapi.pm,1.25,1.26 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/07/29 07:50:04 1.25 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/08/03 00:28:20 1.26 @@ -341,8 +341,7 @@ Returns : listref of hashrefs: [{collection_output_id => Integer, article_name => String, - service_instance_id => Integer, - }] + service_instance_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_collection_output{ @@ -403,7 +402,7 @@ namespace_type_uris => String, article_name => String, service_instance_id => Integer, - collection_input_id => Integer}] + collection_input_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_simple_input{ @@ -460,7 +459,7 @@ namespace_type_uris => String, article_name => String, service_instance_id => Integer, - collection_output_id => Integer}] + collection_output_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_simple_output{ @@ -469,7 +468,7 @@ =head2 insert_simple_output - Title : inse_simple_output + Title : insert_simple_output Usage : my $un = $API->insert_simple_output(%args) Function : Inserts a Simple output into the database Args : object_type_uri => String, @@ -516,7 +515,7 @@ enum_value => String, datatype => String, article_name => String, - service_instance_id => Integer}] + service_instance_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_secondary_input{ @@ -528,12 +527,12 @@ Title : insert_secondary_input Usage : my $un = $API->insert_secondar_input(%args) Function : Inserts a Secondary input into the database - Args : default_value => String, - maximum_value => Float, - minimum_value => Float, - enum_value => String, - datatype => String, - article_name => String, + Args : default_value => String, + maximum_value => Float, + minimum_value => Float, + enum_value => String, + datatype => String, + article_name => String, service_instance_lsid => String Returns : Integer insertid Notes : the fact that it returns an insertid is bad since this @@ -573,7 +572,7 @@ object_type => String, description => String, authority => String, - contact_email => String}] + contact_email => String}, ...] Notes : Only allows querying by lsid or type term =cut sub query_object{ @@ -627,7 +626,7 @@ relationship_type => String, object1_id => String, object2_id => String, - object2_articlename => String}] + object2_articlename => String}, ...] Notes : Only allows querying by lsid or type term =cut sub query_object_term2term{ @@ -687,13 +686,28 @@ authoritative => Integer, description => String, signatureURL => String, - lsid => String}] + lsid => String}, ...] Notes : Allows querying by multiple conditions joined by 'and' =cut sub query_service_instance { die "query_service_instance not implemented in adaptor\n"; } +=head2 query_service_existence + + Title : query_service_existence + Usage : my $un = $API->query_service_existence(%args) + Function : Executes a query to check if the service exists in the database + Args : servicename => String + authority_uri => String + Returns : 1 if service exists + 0 if no such service instance + Notes : Only allows querying by URI of the authority and service name +=cut +sub query_service_existence{ + die "query_service_existence not implemented in adaptor\n"; +} + # This might be redundant of query_service_instance(), since same function can be # replicated by several of its calls sub match_service_type_uri{ @@ -750,7 +764,7 @@ Returns : listref of hashrefs: [{authority_common_name => String, authority_uri => String, - contact_email => String}] + contact_email => String}, ...] Notes : Only allows querying by URI of the authority =cut sub query_authority{ @@ -807,7 +821,7 @@ service_type => String, description => String, authority => String, - contact_email => String}] + contact_email => String}, ...] Notes : the fact that it returns an service_id is bad since this is only useful to an SQL-based API... =cut @@ -861,7 +875,7 @@ [{assertion_id => Integer, relationship_type => String, service1_id => String, - service2_id => String}] + service2_id => String}, ...] Notes : the fact that it returns an service ids is bad since this is only useful to an SQL-based API...should return lsids =cut @@ -917,7 +931,7 @@ die "query_relationship not implemented in adaptor\n"; } -# probably no need for this and not implemented in mysql api +# probably no need for this in the future and not implemented in mysql api sub insert_relationship{ die "insert_relationship not implemented in adaptor\n"; } @@ -932,17 +946,18 @@ # =head2 query_namespace - Title : insert_namespace - Usage : my $un = $API->insert_namespace(%args) - Function : Deletes a namespace instance from the database - Args : namespace_type => String, - namespace_lsid => String, - description => String, - authority => String, - contact_email => String - Returns : Integer mysql_insertid - Notes : the fact that it returns a mysql_insertid is bad since this - is only useful to an SQL-based API... + Title : query_namespace + Usage : my $un = $API->query_namespace(%args) + Function : Executes a query for namespace instances in the database + Args : type => String - either lsid or term for a particular namespace + Returns : listref of hashrefs: + [{namespace_id => Integer, + namespace_lsid => String, + namespace_type => String, + description => String, + authority => String, + contact_email => String}, ...] + =cut sub query_namespace{ die "query_namespace not implemented in adaptor\n"; @@ -991,7 +1006,7 @@ [{assertion_id => Integer, relationship_type => String, namespace1_id => String, - namespace2_id => String}] + namespace2_id => String}, ...] Notes : namespace1_id and namespace2_id will be lsids =cut @@ -1146,7 +1161,11 @@ Args : type => String - either an object name or LSID Returns : listref of hashrefs: [{relationship_type => String, + object_type => String, object_lsid => String, + description => String, + authority => String, + contact_email => String, object2_articlename => String}, ...] one hashref for each relationship between two objects Notes : relationship_type from object_term2term, object_lsid from object, and object2_articlename from object_term2term @@ -1170,7 +1189,7 @@ Returns : reference to array containing array-refs representing the result set: [[String lsid, String relationship_type], ...] each array-ref represents one row - Notes : Only returns distinct lsid from $ontology and relationship_type from $ontology_term2term + Notes : Only returns distinct lsids from $ontology and relationship_type from $ontology_term2term =cut # relationship query for any table used in Moby::OntologyServer->_doRelationshipQuery() From mwilkinson at pub.open-bio.org Wed Aug 3 07:28:52 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 3 08:15:40 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031128.j73BSq2b003770@pub.open-bio.org> mwilkinson Wed Aug 3 07:28:52 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv3751/MOBY Modified Files: Central.pm Log Message: as per Martin's request, there is now a retrieveResourceURLs method in MOBY Central. See Twiki API documentation (in the next few minutes...), or just make the call with no arguments to see the XML. moby-live/Perl/MOBY Central.pm,1.198,1.199 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.198 retrieving revision 1.199 diff -u -r1.198 -r1.199 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/02 15:18:00 1.198 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/03 11:28:52 1.199 @@ -22,7 +22,7 @@ use MOBY::secondary_input; use MOBY::central_db_connection; use MOBY::Config; -use MOBY::Client::Central; +#use MOBY::Client::Central; #use MOBY::RDF::ServiceInstanceRDF; #use RDF::Core; @@ -1205,7 +1205,7 @@ my $conf = MOBY::Config->new(); my $path = $conf->{mobycentral}->{rdfagent}; my $rez = system( $path. " " . $signatureURL ); - return &_error( + return &_success( "The RDFagent call was successful. Report will send to you by E-mail", "" ) @@ -1229,10 +1229,7 @@ if $AuthURI =~ '[/:]'; return &_error( "Malformed authURI - must take the form NNN.NNN.NNN", "" ) unless $AuthURI =~ /\./; - return &_error( -"Malformed email - must be a valid email address of the form name\@organization.foo", - "" - ) + return &_error("Malformed email - must be a valid email address of the form name\@organization.foo","") unless $contactEmail =~ /\S\@\S+\.\S+/; $error .= "missing URL \n" unless defined $URL; $error .= "missing description \n" unless defined $desc; @@ -1249,11 +1246,8 @@ || ( $Category eq "moby" ) ); $debug && &_LOG("Entering switch with $Category method\n"); - return &_error( -"Service categories other than 'moby' and 'wsdl' are not yet implemented", - "" - ) - unless ( ( $Category eq "moby" ) || ( $Category eq "wsdl" ) ); + return &_error("Service categories other than 'moby' and 'wsdl' are not yet implemented","") + unless ( ( $Category eq "moby" ) || ( $Category eq "wsdl" ) ); #test the existence of the service return &_error( "This service already exists", "" ) if (MOBY::service_instance->new( @@ -1437,12 +1431,13 @@ # this is a Simple, Collection, or Parameter object my $simp_coll = $node->nodeName; $debug && &_LOG("TAGNAME in $inout _registerArticle is $simp_coll"); - my $article = - $node->getAttributeNode("articleName"); # may or may not have a name + my $article = $node->getAttributeNode("articleName"); # may or may not have a name if ($article) { $article = $article->getValue() } $debug && &_LOG("ARTICLENAME in _registerArticle is $article"); my ( $object_type, @namespaces ); if ( $simp_coll eq "Collection" ) { +open OUT, 'C;\out.txt'; +print OUT "Collection found\n"; $debug && &_LOG("Collection!\n"); my $collection_id; if ( $inout eq 'input' ) { @@ -1463,9 +1458,14 @@ #my $collection_id=$dbh->{mysql_insertid}; my $Simples = $node->getElementsByTagName('Simple'); my $length = $Simples->size(); +print OUT "Collection has length $length\n"; unless ( $length > 0 ) { - return ( -1, -"Your collection must be a collection of one or more Simple types" + return ( -1,"Your collection must be a collection of one Simple type" + ); + } + unless ( $length == 1 ) { +print "\n\n\n\n\nLENGTH OF SIMPLES WAS $length\n\n\n\n\n"; + return ( -1,"As of API v0.86, Collections must not be of more than one Simple type" ); } for ( my $x = 1 ; $x <= $length ; ++$x ) { @@ -2473,6 +2473,47 @@ return ( $authURI, $serviceName, $InputXML, $OutputXML, $SecondaryXML ); } +=head2 retrieveResourceURLs + + Title : retrieveResourceURLs + Usage : $urls = $MOBY->retrieveResourceURLs + Function : to retrieve the location(s) of the RDF versions of the various + MOBY-S Ontologies + Args : none + Returns : XML (see below). The "name" attribute indicates which ontology + is described by the URL (Service, Object, Namespace, ServiceInstance, Full), + and the "url" attribute provides a URL that, when called with an + HTTP GET, will return RDF-XML describing that ontology. + XML : + + + + + + +=cut + +sub retrieveResourceURLs { + + $CONFIG ||= MOBY::Config->new; # exported by Config.pm + my $central = $CONFIG->{mobycentral}->{resourceURL}; + my $service = $CONFIG->{mobyservice}->{resourceURL}; + my $namespace = $CONFIG->{mobynamespace}->{resourceURL}; + my $object = $CONFIG->{mobyobject}->{resourceURL}; + my $all = $CONFIG->{mobycentral}->{allResources}; + + my $message =""; + $message .="" if $central; + $message .="" if $object; + $message .="" if $service; + $message .="" if $namespace; + $message .="" if $all; + $message .=""; + return $message; +} + + =head2 retrieveServiceProviders Title : retrieveServiceProviders From mwilkinson at pub.open-bio.org Wed Aug 3 07:30:30 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 3 08:16:52 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031130.j73BUUXR003839@pub.open-bio.org> mwilkinson Wed Aug 3 07:30:30 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv3820/MOBY/Client Modified Files: Central.pm Log Message: fixed the client and the test suite to ensure that collections are no longer able to contain multiple simples, as per API 8.86 moby-live/Perl/MOBY/Client Central.pm,1.110,1.111 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.110 retrieving revision 1.111 diff -u -r1.110 -r1.111 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2005/07/31 15:18:54 1.110 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2005/08/03 11:30:30 1.111 @@ -874,27 +874,29 @@ # [articleName1,[objType1 => \@namespaces]], # Simple # [articleName2, [[objType2 => \@namespaces]]], # collection of one object type # [articleName3,[[objType3 => \@namespaces], -# [objType4 => \@namespaces]]] # collection of multiple object types -# ] +# [objType4 => \@namespaces]]] # collection of multiple object types (THIS IS NOW ILLEGAL!) +# ] foreach my $article (@ALLARTICLES) { my ( $articleName, $def ) = @{$article}; $articleName ||= ""; my @Objects; # - unless ( ref($def) =~ /array/i ) { - return $self->errorRegXML( -"invalid structure of $inout objects, expected arrayref for article $articleName" - ); + unless ( (ref($def) =~ /array/i)) { # $def = [objType => \@ns] or $def=[[objType => \@ns]] + return $self->errorRegXML("invalid structure of $inout objects, expected SINGLE arrayref for article $articleName as required by the 0.86 API"); } my @objectdefs; - if ( ( ref $def->[0] ) =~ /array/i ) { # collection + if ( ( ref $def->[0] ) =~ /array/i ) { # collection $def->[0] = [objType => \@ns] # def= [[objType2 => [ns3, ns4...]], ...] $message .= "\n"; - @objectdefs = @{$def}; - } - else { # Nipple - @objectdefs = ($def); - - # def = [objType1 => [ns1, ns2...]], + if (scalar(@{$def->[0]} > 2)){ + return $self->errorRegXML("invalid structure of $inout objects. Collections may not have more than one Simple content type as per API version 0.86"); + } + @objectdefs = @{$def}; + if (scalar(@objectdefs) > 1){ + return $self->errorRegXML("invalid structure of $inout objects. Collections may not have more than one Simple content type as per API version 0.86"); + } + } else { # Simple $def->[0] = objType + # def = [objType1 => [ns1, ns2...]], + @objectdefs = ($def); } foreach my $objectdef (@objectdefs) { if ( ( ref( $def->[0] ) ) =~ /array/i ) { From mwilkinson at pub.open-bio.org Wed Aug 3 07:30:30 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 3 08:17:31 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031130.j73BUUHI003858@pub.open-bio.org> mwilkinson Wed Aug 3 07:30:30 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv3820/t Modified Files: Client-Central.t Log Message: fixed the client and the test suite to ensure that collections are no longer able to contain multiple simples, as per API 8.86 moby-live/Perl/t Client-Central.t,1.26,1.27 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/02 15:18:00 1.26 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/03 11:30:30 1.27 @@ -4,7 +4,7 @@ ######################### # change 'tests => 1' to 'tests => last_test_to_print'; -use SOAP::Lite +trace; +#use SOAP::Lite +trace; use Test::More tests => 123; # perldoc Test::More for details # Test 1 @@ -178,8 +178,38 @@ ) or diag("Service registration failure: ".$r->message) ; +# TEST SHOULD FAIL - testing registration of multiple Simples as part of Collection +$r = $C->registerService( + serviceName => "myfirstservice", + serviceType => "Retrieval", + authURI => "test.suite.com", + contactEmail => 'your@mail.address', + description => "this is my first service", + category => "moby", + URL => "http://illuminae/cgi-bin/service.pl", + input =>[ + ['articleNameMultiSimples', [ + [Object => ['RubbishNamespace'], + String => ['RubbishNamespace'], + ] + ] + ], # Simple + ], + output =>[ + ['articleNameSimpleSingle', [String => ['RubbishNamespace']]], # Simple + ], + secondary => { + parametername1 => { + datatype => 'Integer', + default => 0, + max => 10, + min => -10, + enum => [-10, 10, 0]}}); + +( ok(!$r->success,"Service registration of two simples in a collection successfully failed") +) or diag("Service registration should have failed when registering two Simples in a collection: ".$r->message) ; -# Test 10 +# TEST SHOULD PASS - correct service registration $r = $C->registerService( serviceName => "myfirstservice", serviceType => "Retrieval", @@ -282,10 +312,10 @@ category => "moby", URL => "http://illuminae/cgi-bin/service.pl", input =>[ - ['articleName1', [[Object => ['RubbishNamespace']]]], # Simple + ['articleName1', [[Object => ['RubbishNamespace']]]], # Collection ], output =>[ - ['articleName2', [[String => ['RubbishNamespace']]]], # Simple + ['articleName2', [[String => ['RubbishNamespace']]]], # Collection ], secondary => { parametername1 => { From mwilkinson at pub.open-bio.org Wed Aug 3 08:00:32 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 3 08:46:23 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031200.j73C0Wwb004046@pub.open-bio.org> mwilkinson Wed Aug 3 08:00:32 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv4027/MOBY/Client Modified Files: Central.pm Log Message: added a client-side subroutine to deal with the retreiveResourceURLs MOBY Central method moby-live/Perl/MOBY/Client Central.pm,1.111,1.112 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.111 retrieving revision 1.112 diff -u -r1.111 -r1.112 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2005/08/03 11:30:30 1.111 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2005/08/03 12:00:32 1.112 @@ -1301,6 +1301,44 @@ return $content; } + +=head2 retrieveResourceURLs + + Title : retrieveResourceURLs() + Usage : $names = $MOBY->retrieveResourceURLs() + Function : get a hash of the URL's for each of the MOBY ontologies + Returns : hashref to the following hash + $names{Ontology} = [URL1, URL2,...] + Args : none + +=cut + +sub retrieveResourceURLs { + my ($self, %args) = shift; + my $reg = $args{registry}; + $reg = $reg ? $reg : $self->default_MOBY_servername; + return undef unless ( $self->Connection($reg) ); + +# CODE GOES HERE.... + + + + my ($return) = $self->_call( $reg, 'retrieveResourceURLs', "" ); + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_string($return); + my $root = $doc->getDocumentElement; + my $urls_list = $root->childNodes; + my %urls; + for ( my $x = 1 ; $x <= $urls_list->size() ; $x++ ) { + next unless $urls_list->get_node($x)->nodeType == ELEMENT_NODE; + my $ontology = $urls_list->get_node($x)->getAttributeNode('name')->getValue; + my $url = $urls_list->get_node($x)->getAttributeNode('url')->getValue; + push @{ $urls{$ontology} }, $url + } + return \%urls; +} + + =head2 retrieveServiceNames Title : retrieveServiceNames(%args) From mwilkinson at pub.open-bio.org Wed Aug 3 08:01:53 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 3 08:47:46 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031201.j73C1r11004091@pub.open-bio.org> mwilkinson Wed Aug 3 08:01:53 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv4072/MOBY Modified Files: Central.pm Log Message: uncomment moby client central as it is needed moby-live/Perl/MOBY Central.pm,1.199,1.200 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.199 retrieving revision 1.200 diff -u -r1.199 -r1.200 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/03 11:28:52 1.199 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/03 12:01:53 1.200 @@ -22,7 +22,7 @@ use MOBY::secondary_input; use MOBY::central_db_connection; use MOBY::Config; -#use MOBY::Client::Central; +use MOBY::Client::Central; #use MOBY::RDF::ServiceInstanceRDF; #use RDF::Core; From kawas at pub.open-bio.org Wed Aug 3 12:32:30 2005 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed Aug 3 13:21:44 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031632.j73GWUXn004653@pub.open-bio.org> kawas Wed Aug 3 12:32:30 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/Impl In directory pub.open-bio.org:/tmp/cvs-serv4629/Adaptor/moby/Impl Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/Impl added to the repository moby-live/Perl/MOBY/Adaptor/moby/Impl - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/Impl/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/Impl/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/Impl/RCS/directory,v: No such file or directory From kawas at pub.open-bio.org Wed Aug 3 12:33:55 2005 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed Aug 3 13:21:50 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031633.j73GXtYJ004705@pub.open-bio.org> kawas Wed Aug 3 12:33:55 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby In directory pub.open-bio.org:/tmp/cvs-serv4669/Adaptor/moby Added Files: DataAdapterI.pm DataAccessI.pm Log Message: Adding some skeleton files for use later on. moby-live/Perl/MOBY/Adaptor/moby DataAdapterI.pm,NONE,1.1 DataAccessI.pm,NONE,1.1 From kawas at pub.open-bio.org Wed Aug 3 12:33:55 2005 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Wed Aug 3 13:21:51 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508031633.j73GXtds004690@pub.open-bio.org> kawas Wed Aug 3 12:33:55 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/Impl In directory pub.open-bio.org:/tmp/cvs-serv4669/Adaptor/moby/Impl Added Files: FetaQueryAdaptor.pm NamespaceDataAdapter.pm ServiceInstanceDataAdapter.pm ServiceTypeDataAdapter.pm ObjectDataAdapter.pm Log Message: Adding some skeleton files for use later on. moby-live/Perl/MOBY/Adaptor/moby/Impl FetaQueryAdaptor.pm,NONE,1.1 NamespaceDataAdapter.pm,NONE,1.1 ServiceInstanceDataAdapter.pm,NONE,1.1 ServiceTypeDataAdapter.pm,NONE,1.1 ObjectDataAdapter.pm,NONE,1.1 From dwang at pub.open-bio.org Wed Aug 3 22:12:52 2005 From: dwang at pub.open-bio.org (Dennis Wang) Date: Wed Aug 3 22:58:39 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508040212.j742CqcW005906@pub.open-bio.org> dwang Wed Aug 3 22:12:52 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby In directory pub.open-bio.org:/tmp/cvs-serv5881/Perl/MOBY/Adaptor/moby Modified Files: queryapi.pm Log Message: queryapi documentation reviewed moby-live/Perl/MOBY/Adaptor/moby queryapi.pm,1.26,1.27 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/08/03 00:28:20 1.26 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/08/04 02:12:52 1.27 @@ -276,7 +276,16 @@ } +# this should replace all other delete_*_input +# still incomplete +sub delete_inputs{ + die "delete_inputs not implemented in adaptor\n"; +} +#still incomplete +sub delete_output { # this should replace all other delete_*_output + die "delete_output not implemented in adaptor\n"; +} # # collection_input table functions @@ -1026,7 +1035,18 @@ die "delete_namespace_term2term not implemented in adaptor\n"; } -# still incomplete... +=head2 check_object_usage + + Title : check_object_usage + Usage : my $un = $API->check_object_usage(%args) + Function : Execute a custom query for objects that are used by some service + Args : type => String - either namespace_lsid or namespace_term + Returns : a list: + ($err, $errstr) + $err = 1 if namespace is used by a service, 0 otherwise + $errstr = contains the error message + +=cut # custom query subroutine for Moby::Central.pm->deregisterObjectClass() sub check_object_usage{ die "check_object_usage not implemented in adaptor\n"; @@ -1037,8 +1057,7 @@ Title : check_namespace_usage Usage : my $un = $API->check_namespace_usage(%args) Function : Execute a custom query for namespaces that are used by some service - Args : namespace_type_uris => String - namespace_type_uris you are checking for - term => String - the type of the namespace + Args : type => String - either namespace_lsid or namespace_term Returns : a list: ($err, $errstr) $err = 1 if namespace is used by a service, 0 otherwise @@ -1071,7 +1090,7 @@ Each hash represents a service Notes : the fact that it returns a service_instance_id is bad since this is only useful to an SQL-based API... - Keywords are assumed to be joined by "OR" for the query + Keywords are assumed to be joined by "OR" for the query =cut # custom query routine for Moby::Central.pm -> findService() From gordonp at pub.open-bio.org Wed Aug 3 22:50:31 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Wed Aug 3 23:36:26 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508040250.j742oVGE006020@pub.open-bio.org> gordonp Wed Aug 3 22:50:31 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv5995 Modified Files: SimpleClient.html Log Message: Incremental update moby-live/Java/docs SimpleClient.html,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/07/22 05:00:58 1.3 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 02:50:31 1.4 @@ -151,12 +151,13 @@

Creating a "primitive" data object

The following data are considered irreducible, atomic, or "primitive" in MOBY: + - + @@ -169,7 +170,7 @@
MobyDataString sequenceString = new MobyDataString("MPGGFILAIDEGTTSARAIIYNQDLEVLGIGQYDFPQHYPSPGYVEHNPDEIWNAQMLAI");
MobyDataInt sequenceLength = new MobyDataInt(60);
MobyDataFloat sequencePI = new MobyDataFloat(3.67);
-
MobyDataFloat sequenceBlastEValue = new MobyDataFloat("1e-29");
+
MobyDataFloat sequenceBlastEValue = new MobyDataFloat("1e-29");
MobyDataDateTime blastDBUpdated = new MobyDataDateTime("2005-03-24");

@@ -193,11 +194,26 @@

Manipulating jMOBY data

-Coming soon. +One does not only want to create data objects, but also retrieve information from them and edit them. +As a client, one may need to display or filter service response data. As a service provider, one needs to extract +information from submitted queries. The jMOBY data instance API endeavours to make these data easily extractable and mutable.

Dissecting queries and responses

+

Changing data objects

+

The getObject method allows the user to retrieve the underlying internal +representation of the MOBY data in any MobyDataInstance. The returned Object can be safely +cast as listed in the primitives table above, MobyDataComposite +uses a HashMap, MobyDataObjectSet uses a Vector. Modifying mutable returned +object modifies the MobyDataObject from which it came. For example: + +

+
+
+ +

+

Creating MOBY XML (responses and queries)

@@ -257,7 +273,7 @@
Paul Gordon
-Last modified: Thu Jul 21 23:45:59 MDT 2005 +Last modified: Fri Jul 22 22:13:34 MDT 2005 From gordonp at pub.open-bio.org Thu Aug 4 00:13:31 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Thu Aug 4 00:59:22 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508040413.j744DVDV006186@pub.open-bio.org> gordonp Thu Aug 4 00:13:31 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv6161 Modified Files: SimpleClient.html Log Message: Incremental update moby-live/Java/docs SimpleClient.html,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 02:50:31 1.4 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 04:13:31 1.5 @@ -200,18 +200,37 @@

Dissecting queries and responses

+

If we were a service provider who received a MobyDataInstance, we can check its type, then dissect it +and extract the fields. Suppose we are a PSI-BLAST provider. We accept AminoAcidSequence: + +

+//...receive data (see last section of this tutorial), a MobyDataInstance called "data"
+if(! data.getDataType().getName().equals("AminoAcidSequence")){
+   throw new MobyException("Expected an AminoAcidSequence, but instead found " + data.getDataType());
+}
+String aaSequence = ((MobyDataString) data.get("SequenceString")).toString();
+int aaLength = ((MobyDataInt) data.get("Length")).intValue();  // Like java.lang.Number.intValue()
+
+ +Two notes about this example: 1. eventually we should have a method in MobyDataType with the signature inheritsFrom(MobyDataType), as this would allow us to easily validate input that is a subclass of AminoAcidSequence, and 2. I have assumed that the length of the sequence is not greater than the maximum capacity of a Java integer. If the field I was dealing with may be larger than 2 to the 32nd power, I should call longValue() or even better getObject() which returns an infinite precision BigInteger.

Changing data objects

The getObject method allows the user to retrieve the underlying internal representation of the MOBY data in any MobyDataInstance. The returned Object can be safely cast as listed in the primitives table above, MobyDataComposite uses a HashMap, MobyDataObjectSet uses a Vector. Modifying mutable returned -object modifies the MobyDataObject from which it came. For example: +object modifies the MobyDataObject from which it came. For example, building on the previous example:

+StringBuffer mutableSequence = (StringBuffer) ((MobyDataString) data.get("SequenceString")).getObject();
+mutableSequence.replace(0, 2, "XXX");
 
+data.setXmlMode(MobyDataInstance.SERVICE_XML_MODE);
+System.out.println(data.toXML());
 
+This would print the sequence XML, with the first three letters of the sequence string being "XXX". Note that you do have to do some casting to get all of these data right. When jMOBY requires Java 1.5, we can get rid of several of these cast annoyances by using the Generics construct. +


@@ -250,7 +269,7 @@

Create a MOBY XML response or query envelope with multiple invocations

Use the default constructor for MobyContentInstance, then add at least one MobyDataInstance -to it using the java.lang.Map interface or the convenient one-arg put method. +to it using the java.lang.Map interface or the convenient one-arg put method. To clarify, sending the content block to a service provider is requesting that a service acting on a gi namespace object be invoked for two separate input data. We are not calling a service that takes two MOBY Objects as input.

 MobyContentInstance queries = new MobyContentInstance();
 data.put(new MobyDataObject("gi", "100089"));
@@ -261,10 +280,11 @@
 
 

Parsing MOBY XML

-

As a counterpart to the utility above, jMOBY provides a method to deserialize a response/request envelope: +

As a counterpart to the utility above, jMOBY provides a method to deserialize a response/request envelope, useful if you are rolling your own server:

 MobyContentInstance queries = MobyDataUtils.fromXMLDocument(System.in);
 System.out.println("The document contained " + ((queries.size() == 1) ? "1 query" : (query.size() + " queries")));
+//Use the HashMap functions to retrieve individual queries...
 

@@ -273,7 +293,7 @@
Paul Gordon
-Last modified: Fri Jul 22 22:13:34 MDT 2005 +Last modified: Wed Aug 3 23:08:06 MDT 2005 From gordonp at pub.open-bio.org Thu Aug 4 00:16:41 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Thu Aug 4 01:02:45 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508040416.j744Gfpd006258@pub.open-bio.org> gordonp Thu Aug 4 00:16:41 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory pub.open-bio.org:/tmp/cvs-serv6229 Modified Files: MobyDataFloat.java MobyDataInt.java Log Message: Added convenience methods to retrieve Java primitives from the Moby data directly, with a precision loss warning in the Javadocs moby-live/Java/src/main/org/biomoby/shared/data MobyDataFloat.java,1.3,1.4 MobyDataInt.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java 2005/07/22 05:11:54 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java 2005/08/04 04:16:41 1.4 @@ -225,6 +225,15 @@ public Object getObject(){ return value; } + /** + * A convenience method, which returns the underlying BigInteger's primitive int representation. + * Caution: if the number is too big to fit, you'll end up with Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY + * Caution, you may lose precision on the data, even if it is within the range, especially for large e-value from BLAST, etc. + * Use the BigDecimal returned by getObject if you aren't sure of the range of your input. + */ + public double doubleValue(){ + return value.doubleValue(); + } public String getValue(){ return ""+value; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java 2005/07/22 05:11:54 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java 2005/08/04 04:16:41 1.4 @@ -269,12 +269,30 @@ } /** - * @return a BigInteger + * @return a BigInteger, the full precision value of the data */ public Object getObject(){ return value; } + /** + * A convenience method, which returns the underlying BigInteger's primitive int representation. + * Caution: if the number is too big to fit, you're only getting the lower 32 bits! + * Use the BigInteger returned by getObject if you aren't sure of the range of your input. + */ + public int intValue(){ + return value.intValue(); + } + + /** + * A convenience method, which returns the underlying BigInteger's primitive int representation. + * Caution: if the number is too big to fit, you're only getting the lower 64 bits! + * Use the BigInteger returned by getObject if you aren't sure of the range of your input. + */ + public long longValue(){ + return value.longValue(); + } + public String getValue(){ return ""+value; } From mwilkinson at pub.open-bio.org Thu Aug 4 05:05:38 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu Aug 4 05:51:31 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508040905.j7495cjJ007659@pub.open-bio.org> mwilkinson Thu Aug 4 05:05:38 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv7617/t Modified Files: Client-Central.t Log Message: cleaning up code, fixed docs. If tests pass, then commented code will be removed moby-live/Perl/t Client-Central.t,1.27,1.28 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/03 11:30:30 1.27 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/04 09:05:38 1.28 @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; #use SOAP::Lite +trace; -use Test::More tests => 123; # perldoc Test::More for details +use Test::More tests => 125; # perldoc Test::More for details # Test 1 BEGIN { use_ok('MOBY::Client::Central') }; @@ -177,10 +177,9 @@ ( ok(!$r->success,"Service registration correctly failed testing secondary datatype format") ) or diag("Service registration failure: ".$r->message) ; - -# TEST SHOULD FAIL - testing registration of multiple Simples as part of Collection +# Test should fail due lack of an articlename on input $r = $C->registerService( - serviceName => "myfirstservice", + serviceName => "myfirstserviceinputtest", serviceType => "Retrieval", authURI => "test.suite.com", contactEmail => 'your@mail.address', @@ -188,6 +187,33 @@ category => "moby", URL => "http://illuminae/cgi-bin/service.pl", input =>[ + ['', [Object => ['RubbishNamespace']]], # Simple + ], + output =>[ + ['outputarticle', [String => ['RubbishNamespace']]], # Simple + ], + secondary => { + parametername1 => { + datatype => 'Integer', + default => 0, + max => 10, + min => -10, + enum => [-10, 10, 0]}}); + +( ok(!$r->success,"Service registration correctly failed testing lack of articleName") +) or diag("Service registration was supposed to fail due to lack of articleName on input, but didn't: ".$r->message) ; + + +# TEST SHOULD FAIL - testing registration of multiple Simples as part of Collection +$r = $C->registerService( + serviceName => "myfirstservicemultiplesimples", + serviceType => "Retrieval", + authURI => "test.suite.com", + contactEmail => 'your@mail.address', + description => "this is my first service", + category => "moby", + URL => "http://illuminae/cgi-bin/service.pl", + input =>[ ['articleNameMultiSimples', [ [Object => ['RubbishNamespace'], String => ['RubbishNamespace'], @@ -243,7 +269,7 @@ ) or diag("Service discovery failure") ; isa_ok($si, 'ARRAY') or diag("findService didn't return an array ref"); -is(scalar(@$si),1) or diag("findService found too many services"); +is(scalar(@$si),1) or diag("findService found wrong number of services"); $SI = shift @$si; isa_ok($SI, 'MOBY::Client::ServiceInstance') or diag("findService didn't return a MOBY::Client::ServceInstance"); isa_ok($SI->input, ARRAY) or diag ("ServiceInstance object input is not a listref"); From mwilkinson at pub.open-bio.org Thu Aug 4 05:05:38 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu Aug 4 05:51:34 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508040905.j7495cYj007640@pub.open-bio.org> mwilkinson Thu Aug 4 05:05:38 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv7617/MOBY Modified Files: Central.pm CommonSubs.pm Log Message: cleaning up code, fixed docs. If tests pass, then commented code will be removed moby-live/Perl/MOBY Central.pm,1.200,1.201 CommonSubs.pm,1.65,1.66 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.200 retrieving revision 1.201 diff -u -r1.200 -r1.201 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/03 12:01:53 1.200 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/04 09:05:38 1.201 @@ -22,7 +22,7 @@ use MOBY::secondary_input; use MOBY::central_db_connection; use MOBY::Config; -use MOBY::Client::Central; +#use MOBY::Client::Central; #use MOBY::RDF::ServiceInstanceRDF; #use RDF::Core; @@ -70,7 +70,7 @@ CLIENT-SIDE use SOAP::Lite +autodispatch => - proxy => 'http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY05/mobycentral.pl', + proxy => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', on_fault => sub { my($soap, $res) = @_; die ref $res ? $res->faultstring : $soap->transport->status, "\n"; @@ -1309,24 +1309,24 @@ foreach my $IN (@IN) { my ( $success, $msg ) = &_registerArticles( $SVC, "input", $IN, undef ); - return &_error( - "Registration Failed During INPUT Article Registration: $msg", "" ) - unless ( $success == 1 ); + unless ( $success == 1 ){ + $SVC->DELETE_THYSELF; + return &_error("Registration Failed During INPUT Article Registration: $msg", "" ) + } } foreach my $OUT (@OUT) { - my ( $success, $msg ) = - &_registerArticles( $SVC, "output", $OUT, undef ); - return &_error( - "Registration Failed During OUTPUT Article Registration: $msg", "" ) - unless ( $success == 1 ); + my ( $success, $msg ) = &_registerArticles( $SVC, "output", $OUT, undef ); + unless ( $success == 1 ){ + $SVC->DELETE_THYSELF; + return &_error("Registration Failed During OUTPUT Article Registration: $msg", "" ) + } } foreach my $SEC (@SECS) { - my ( $success, $msg ) = - &_registerArticles( $SVC, "secondary", $SEC, undef ); - return &_error( - "Registration Failed During SECONDARY Article Registration: $msg", - "" ) - unless ( $success == 1 ); + my ( $success, $msg ) = &_registerArticles( $SVC, "secondary", $SEC, undef ); + unless ( $success == 1 ){ + $SVC->DELETE_THYSELF; + return &_error("Registration Failed During SECONDARY Article Registration: $msg", "" ) + } } # we're going to do a findService here to find the service that we just created @@ -1342,13 +1342,10 @@ ); unless ($si) { $SVC->DELETE_THYSELF; - return &_error( -"Registration Failed - newly registered service could not be discovered", - "" - ); + return &_error("Registration Failed - newly registered service could not be discovered",""); } - my $services = MOBY::Client::Central::_parseServices( '', '', $si ); - my $service_instance = shift @{$services}; + #my $services = MOBY::Client::Central::_parseServices( '', '', $si ); + #my $service_instance = shift @{$services}; # my $storage = new RDF::Core::Storage::Memory; # my $model = new RDF::Core::Model( Storage => $storage ); @@ -1425,19 +1422,21 @@ sub _registerArticles { my ( $SVC, $inout, $node, $collid ) = @_ ; # node is a node of the XML dom representing an article to be registered - my $dbh = $SVC->dbh; return ( -1, 'Bad node' ) unless $node->nodeType == ELEMENT_NODE; # this is a Simple, Collection, or Parameter object my $simp_coll = $node->nodeName; $debug && &_LOG("TAGNAME in $inout _registerArticle is $simp_coll"); - my $article = $node->getAttributeNode("articleName"); # may or may not have a name + my $article = $node->getAttributeNode("articleName"); + if ($article) { $article = $article->getValue() } $debug && &_LOG("ARTICLENAME in _registerArticle is $article"); + if (lc($inout) eq "input"){ + return (-1, "Input Simples and collections are required to have an articleName as of API version 0.86") if (!$article && !$collid); + } + my ( $object_type, @namespaces ); if ( $simp_coll eq "Collection" ) { -open OUT, 'C;\out.txt'; -print OUT "Collection found\n"; $debug && &_LOG("Collection!\n"); my $collection_id; if ( $inout eq 'input' ) { @@ -1453,29 +1452,21 @@ return ( -1, "found article that was neither input nor output" ); } -# the following SQl belongs in the service_instance object, but screw it, I'm running out of time! -#$dbh->do("insert into collection_$inout (service_instance_id, article_name) values (?,?)", undef, ($SVC->service_instance_id, $article)); -#my $collection_id=$dbh->{mysql_insertid}; my $Simples = $node->getElementsByTagName('Simple'); my $length = $Simples->size(); -print OUT "Collection has length $length\n"; unless ( $length > 0 ) { return ( -1,"Your collection must be a collection of one Simple type" ); } unless ( $length == 1 ) { -print "\n\n\n\n\nLENGTH OF SIMPLES WAS $length\n\n\n\n\n"; return ( -1,"As of API v0.86, Collections must not be of more than one Simple type" ); } for ( my $x = 1 ; $x <= $length ; ++$x ) { - my ( $success, $message ) = - &_registerArticles( $SVC, $inout, $Simples->get_node($x), - $collection_id ); + my ( $success, $message ) = &_registerArticles( $SVC, $inout, $Simples->get_node($x), $collection_id ); unless ( $success == 1 ) { return ( -1, $message ); } } - } - elsif ( $simp_coll eq "Simple" ) { + } elsif ( $simp_coll eq "Simple" ) { my $article = $node->getAttributeNode("articleName"); $article = $article->getValue() if $article; @@ -1517,7 +1508,7 @@ } } chop($namespace_string); # remove trailing comma - my $dbh = $SVC->dbh; + my $service_instance_id; unless ($collid) { # this SIMPLE is either alone, or is part of a COLLECTION ($collid > 0) @@ -1533,9 +1524,7 @@ ); unless ($sinput) { $SVC->DELETE_THYSELF; - return ( -1, -"registration failed during registration of input object $typeURI. Unknown reasons." - ); + return ( -1, "registration failed during registration of input object $typeURI. Unknown reasons."); } } elsif ( $inout eq 'output' ) { @@ -1547,8 +1536,7 @@ ); unless ($soutput) { $SVC->DELETE_THYSELF; - return ( -1, -"registration failed during registration of output object $typeURI. Unknown reasons." + return ( -1,"registration failed during registration of output object $typeURI. Unknown reasons." ); } } @@ -1573,8 +1561,7 @@ map { $valid = 1 if $datatype eq $_ } @{$secondaries}; unless ($valid) { $SVC->DELETE_THYSELF; - return ( -1, -"Registration failed. $datatype must be one of type Integer, String, DateTime, or Float." + return ( -1,"Registration failed. $datatype must be one of type Integer, String, DateTime, or Float." ); } @@ -1903,7 +1890,7 @@ # we also count the number of criterion # we only want the service_id's that appear as many times as the criterion we have # since they will have matched every criterion. - my $dbh = MOBY::central_db_connection->new()->dbh; + if ( $findme{authoritative} ) { ++$criterion_count; $debug @@ -1918,7 +1905,7 @@ unless ( scalar @{$ids} ) { - return &_serviceListResponse( $dbh, undef ); + return &_serviceListResponse(undef ); } $debug && _LOG( "services " . ( join ',', @{$ids} ) . " incrememted\n" ); @@ -1933,7 +1920,7 @@ my ( $exists, $message, $URI ) = $OS->serviceExists( term => $findme{serviceType} ); unless ($exists) { - return &_serviceListResponse( $dbh, undef ); + return &_serviceListResponse(undef ); } ++$criterion_count; $debug @@ -1967,7 +1954,7 @@ my $ids = _extract_ids($adaptor->query_service_instance(authority_uri => $findme{'authURI'})); unless ( scalar @{$ids} ) { - return &_serviceListResponse( $dbh, undef ); + return &_serviceListResponse(undef ); } $debug && _LOG( "services " . ( join ',', @{$ids} ) . " incrememted\n" ); @@ -1985,7 +1972,7 @@ my $ids = _extract_ids($adaptor->query_service_instance(servicename => $findme{servicename})); unless ( scalar @{$ids} ) { - return &_serviceListResponse( $dbh, undef ); + return &_serviceListResponse( undef ); } $debug && _LOG( "services " . ( join ',', @{$ids} ) . " incrememted\n" ); @@ -2003,7 +1990,7 @@ my $ids = _extract_ids($adaptor->query_service_instance(category => lc( $findme{category}) )); unless ( scalar @{$ids} ) { - return &_serviceListResponse( $dbh, undef ); + return &_serviceListResponse( undef ); } $debug && _LOG( "services " . ( join ',', @{$ids} ) . " incrememted\n" ); @@ -2021,7 +2008,7 @@ $ids = _extract_ids($ids); # this is the hash-list that comes back from do_query unless ( scalar @{$ids} ) { - return &_serviceListResponse( $dbh, undef ); + return &_serviceListResponse( undef ); } $debug && _LOG( "services " . ( join ',', @{$ids} ) . " incrememted\n" ); @@ -2038,8 +2025,7 @@ my $obj = ( shift @{ $findme{inputObjects} } ); my @si_ids; @si_ids = - &_searchForServicesWithArticle( $dbh, "input", $obj, - $findme{'expandObjects'}, '' ) + &_searchForServicesWithArticle( "input", $obj,$findme{'expandObjects'}, '' ) if defined $obj; $debug && _LOG("Initial Search For Services with INPUT Article found @si_ids\n"); @@ -2053,11 +2039,10 @@ { # iterate through the rest of the objects next unless $obj; $debug - && _LOG( "FIRST: ", $dbh, "input", $obj, + && _LOG( "FIRST: ", "input", $obj, $findme{'expandObjects'}, '' ); my @new_ids = - &_searchForServicesWithArticle( $dbh, "input", $obj, - $findme{'expandObjects'}, '' ); # get their service ids + &_searchForServicesWithArticle("input", $obj,$findme{'expandObjects'}, '' ); # get their service ids $debug && _LOG("Subsequent Search For Services with INPUT Article found @new_ids\n"); my @good_ids; @@ -2093,8 +2078,7 @@ "outputObject added; criterion count is now $criterion_count\n"); my $obj = ( shift @{ $findme{outputObjects} } ); my @si_ids; - @si_ids = &_searchForServicesWithArticle( $dbh, "output", $obj, '' ) - if defined $obj; + @si_ids = &_searchForServicesWithArticle("output", $obj, '' )if defined $obj; $debug && _LOG( "Initial Search For Services with OUTPUT Article found @si_ids\n"); @@ -2108,11 +2092,10 @@ { # iterate through the rest of the objects next unless $obj; my @new_ids = - &_searchForServicesWithArticle( $dbh, "output", $obj, '' ) + &_searchForServicesWithArticle("output", $obj, '' ) ; # get their service ids $debug - && _LOG( -"Subsequent Search For Services with OUTPUT Article found @new_ids\n" + && _LOG("Subsequent Search For Services with OUTPUT Article found @new_ids\n" ); my @good_ids; my %good_ids; @@ -2151,7 +2134,7 @@ $criterion_count; # has to have matched every criterion push @final, $id; } - return &_serviceListResponse( $dbh, @final ); + return &_serviceListResponse(@final ); } sub _extract_ids { @@ -2170,22 +2153,22 @@ #Eddie - converted sub _searchForServicesWithArticle { - my ( $dbh, $inout, $node, $expand, $coll ) = @_; + my ($inout, $node, $expand, $coll ) = @_; return () unless $node->nodeType == ELEMENT_NODE; # this will erase all current successful service instances! $debug - && _LOG( "searchServWthArticle ", $dbh, $inout, $node, $expand, $coll ); + && _LOG( "searchServWthArticle ", $inout, $node, $expand, $coll ); # this element node may be a Simple or a Collection object my $simp_coll = $node->nodeName; $debug && &_LOG("TAGNAME in _searchForArticle is $simp_coll"); my @valid_ids; if ( $simp_coll eq "Collection" ) { - @valid_ids = &_searchForCollection( $dbh, $node, $expand, $inout ); + @valid_ids = &_searchForCollection( $node, $expand, $inout ); } elsif ( $simp_coll eq "Simple" ) { - @valid_ids = &_searchForSimple( $dbh, $node, $expand, $inout ); + @valid_ids = &_searchForSimple( $node, $expand, $inout ); } return @valid_ids; } @@ -2196,8 +2179,8 @@ # returns list of service_instance ID's # that match this simple - my ( $dbh, $node, $expand, $inout ) = @_; - $debug && _LOG( $dbh, $node, $expand, $inout ); + my ( $node, $expand, $inout ) = @_; + $debug && _LOG( $node, $expand, $inout ); my ( $objectURI, $namespaceURIs ) = &_extractObjectTypesAndNamespaces($node); # (objectType, [ns1, ns2, ns3]) unless ($objectURI) { return () } @@ -2253,7 +2236,7 @@ $CONFIG ||= MOBY::Config->new; # exported by Config.pm my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); - my ( $dbh, $node, $expand, $inout ) = + my ( $node, $expand, $inout ) = @_; # $node in this case is a Collection object # luckily, we can return a redundant list of service id's and @@ -2535,7 +2518,6 @@ my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); my ($pkg) = @_; - my $dbh = MOBY::central_db_connection->new()->dbh; my $result = $adaptor->get_all_authorities(); @@ -2569,7 +2551,7 @@ my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); my ($pkg) = shift; - my $dbh = MOBY::central_db_connection->new()->dbh; + my $result = $adaptor->get_service_names(); my $names = "\n"; foreach my $row (@$result) { @@ -2610,8 +2592,7 @@ if ( $desc =~ /[^\]]+))\]\]>/ ) { $desc = $1; } - $types .= -"\n\n\n"; + $types .="\n\n\n"; } $types .= "\n"; return $types; @@ -2653,8 +2634,7 @@ if ( $desc =~ /[^\]]+))\]\]>/ ) { $desc = $1; } - $types .= -"\n\n\n"; + $types .="\n\n\n"; } $types .= "\n"; return $types; @@ -2688,8 +2668,7 @@ if ( $desc =~ /[^\]]+))\]\]>/ ) { $desc = $1; } - $obj .= -"\n\n\n"; + $obj .="\n\n\n"; } $obj .= "\n"; return $obj; @@ -2792,8 +2771,7 @@ if ( $desc =~ /[^\]]+))\]\]>/ ) { $desc = $1; } - $ns .= -"\n\n\n"; + $ns .= "\n\n\n"; } $ns .= ""; return $ns; @@ -3005,24 +2983,24 @@ *DUMP = \&DUMP_MySQL; # alias it for backward compatibility *DUMP = \&DUMP_MySQL; # alias it for backward compatibility -sub _flatten { - $CONFIG ||= MOBY::Config->new; # exported by Config.pm - my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); - - # from a given term, traverse the ontology - # and flatten it into a list of parent terms - my ( $dbh, $type, $term, $seen ) = @_; - - my $result = $adaptor->get_parent_terms(relationship_type_id => $type, - term => $term); - - foreach my $row (@$result) { - my $term = $row->{term}; - next if ${$seen}{$term}; - &_flatten( $dbh, $type, $term, $seen ); - ${$seen}{$term} = 1; - } -} +#sub _flatten { +# $CONFIG ||= MOBY::Config->new; # exported by Config.pm +# my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); +# +# # from a given term, traverse the ontology +# # and flatten it into a list of parent terms +# my ( $dbh, $type, $term, $seen ) = @_; +# +# my $result = $adaptor->get_parent_terms(relationship_type_id => $type, +# term => $term); +# +# foreach my $row (@$result) { +# my $term = $row->{term}; +# next if ${$seen}{$term}; +# &_flatten( $dbh, $type, $term, $seen ); +# ${$seen}{$term} = 1; +# } +#} #Eddie - Converted sub _ISAPayload { @@ -3052,48 +3030,48 @@ =head2 _getValidServices Title : _getValidServices - Usage : %valid = $MOBY->_getValidServices($dbh, $sth_hash, $query, $max_return) + Usage : %valid = $MOBY->_getValidServices($sth_hash, $query, $max_return) Function : execute the query in $query to return a non-redundant list of matching services Returns : XML Args : none =cut -sub _getValidServices { - my ( $dbh, $sth_hash, $query, $max_return ) = @_; - my %sth = %{$sth_hash}; - $debug && &_LOG("QUERY: \n$query\n\n"); - my $this_query = $dbh->prepare($query); - $this_query->execute; - my $response; - my %seen; - $response = "\n"; - - while ( my ( $serviceName, $objectOUT, $AuthURI, $desc, $type, $cat ) = - $this_query->fetchrow_array() ) - { - $debug - && &_LOG("$serviceName, $objectOUT, $AuthURI,$desc, $type, $cat\n"); - next - if $seen{ "$AuthURI" . "||" - . "$serviceName" }; # non-redundant list please - $seen{ "$AuthURI" . "||" . "$serviceName" } = 1; - $response .= - "\n"; - $response .= "$cat\n"; - $response .= "$type\n"; - $response .= "$objectOUT\n"; - if ( $desc =~ /[^\]]+))\]\]>/ ) { - $desc = $1; - } - $response .= "\n"; - $response .= "\n"; - if ($max_return) { --$max_return; last unless $max_return } - } - $response .= "\n"; - $debug && &_LOG("\nFINAL RESPONSE IS \n$response\n\n"); - return $response; -} +#sub _getValidServices { +# my ($sth_hash, $query, $max_return ) = @_; +# my %sth = %{$sth_hash}; +# $debug && &_LOG("QUERY: \n$query\n\n"); +# my $this_query = $dbh->prepare($query); +# $this_query->execute; +# my $response; +# my %seen; +# $response = "\n"; +# +# while ( my ( $serviceName, $objectOUT, $AuthURI, $desc, $type, $cat ) = +# $this_query->fetchrow_array() ) +# { +# $debug +# && &_LOG("$serviceName, $objectOUT, $AuthURI,$desc, $type, $cat\n"); +# next +# if $seen{ "$AuthURI" . "||" +# . "$serviceName" }; # non-redundant list please +# $seen{ "$AuthURI" . "||" . "$serviceName" } = 1; +# $response .= +# "\n"; +# $response .= "$cat\n"; +# $response .= "$type\n"; +# $response .= "$objectOUT\n"; +# if ( $desc =~ /[^\]]+))\]\]>/ ) { +# $desc = $1; +# } +# $response .= "\n"; +# $response .= "\n"; +# if ($max_return) { --$max_return; last unless $max_return } +# } +# $response .= "\n"; +# $debug && &_LOG("\nFINAL RESPONSE IS \n$response\n\n"); +# return $response; +#} =head2 _getServiceWSDL @@ -3149,24 +3127,24 @@ return $wsdl; } -sub _getCGIService { - my ( $dbh, $sth_hash, $id, $serviceName, $AuthURI, $URL, $desc, $category ) - = @_; - my %sth = %{$sth_hash}; - - # "Select OE.term, O.xsd, SP.type - # from Object as O, OntologyEntry as OE, ServiceParameter as SP, Service as S - # where O.ontologyentry_id = OE.id - # AND SP.ontologyentry_id = OE.id - # and SP.service_id = ? - my $sth = $dbh->prepare( $sth{get_server_parameters} ); - $sth->execute($id); - my ( $Object, $sprintf, $in ) = $sth->fetchrow_array(); - if ( $sprintf =~ /[^\]]+))\]\]>/ ) { - $sprintf = $1; - } - return ""; -} +#sub _getCGIService { +# my ( $dbh, $sth_hash, $id, $serviceName, $AuthURI, $URL, $desc, $category ) +# = @_; +# my %sth = %{$sth_hash}; +# +# # "Select OE.term, O.xsd, SP.type +# # from Object as O, OntologyEntry as OE, ServiceParameter as SP, Service as S +# # where O.ontologyentry_id = OE.id +# # AND SP.ontologyentry_id = OE.id +# # and SP.service_id = ? +# my $sth = $dbh->prepare( $sth{get_server_parameters} ); +# $sth->execute($id); +# my ( $Object, $sprintf, $in ) = $sth->fetchrow_array(); +# if ( $sprintf =~ /[^\]]+))\]\]>/ ) { +# $sprintf = $1; +# } +# return ""; +#} #Eddie - converted @@ -3319,7 +3297,7 @@ $CONFIG ||= MOBY::Config->new; # exported by Config.pm my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); - my ( $dbh, @ids ) = @_; + my (@ids ) = @_; my $output = ""; my $OSobj = MOBY::OntologyServer->new( ontology => 'object' ); my $OSns = MOBY::OntologyServer->new( ontology => 'namespace' ); @@ -3501,6 +3479,9 @@ sub _error { my ( $message, $id ) = @_; + $id ||=""; + $message ||=""; + my $reg = &Registration( { success => 0, =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2005/06/30 11:41:25 1.65 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2005/08/04 09:05:38 1.66 @@ -1623,7 +1623,6 @@ =cut sub whichDeepestParentObject { - use MOBY::Client::OntologyServer; my ( $CENTRAL, $queryTerm, $termlist ) = @_; return ( undef, undef ) unless ( $CENTRAL From kawas at pub.open-bio.org Thu Aug 4 08:58:41 2005 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu Aug 4 09:49:29 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508041258.j74Cwfpn008141@pub.open-bio.org> kawas Thu Aug 4 08:58:41 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier In directory pub.open-bio.org:/tmp/cvs-serv8093/org/biomoby/registry/rdfagent/verifier Modified Files: Main.java Communicator.java Log Message: The Agent, as far as i can tell, now works as expected. I will be changing the way that email is sent next. moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier Main.java,1.4,1.5 Communicator.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2005/04/16 14:32:12 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Main.java 2005/08/04 12:58:41 1.5 @@ -12,99 +12,118 @@ import com.hp.hpl.jena.rdf.model.Model; - /** * @author Nina Opushneva - * * + * */ public class Main { - public static void main(String[] args) { + public static void main(String[] args) { + StringBuffer failedServices = new StringBuffer(); + Log.start(); + + String report = Constants.RDFagentHome + Constants.SV_REPORT_PATH; + Report.createFile(report); + + Date now = new Date(); + + Report + .doWrite("****************************************************************************************"); + Report.doWrite(" START MOBY RDFAGENT REPORT " + + now.toString()); + Report + .doWrite("****************************************************************************************"); + + Report.add(" RDFAGENT REPORT " + now.toString()); + Report + .add("****************************************************************************************"); + + Hashtable serviceList = new Hashtable(); + String signURL = ""; + Calendar c = Calendar.getInstance(); + + if (args.length == 0) { + + String delfile = Constants.RDFagentHome + Constants.SV_DELFILE_PATH; + Report.createFile(delfile); + + // DataMngr.delServiceSetByURL(signURL); + + String url_path = Constants.RDFagentHome + + Constants.SV_SIGN_URL_PATH; + + String filename = url_path + "_" + c.get(Calendar.DAY_OF_MONTH) + + "_" + c.get(Calendar.MONTH); + Report.createFile(filename); + serviceList = DataMngr.getServices(filename); + /* + * }else if (args[0].equals("list")){ serviceList = + * Communicator.readFromFile(args[1]); + * + * }else if (args[0].equals("sign")){ + */ + } else { - - Log.start(); - - String report = Constants.RDFagentHome+Constants.SV_REPORT_PATH; - Report.createFile(report); - - - Date now = new Date(); - - Report.doWrite("****************************************************************************************"); - Report.doWrite(" START MOBY RDFAGENT REPORT "+now.toString()); - Report.doWrite("****************************************************************************************"); - - Report.add(" RDFAGENT REPORT "+now.toString()); - Report.add("****************************************************************************************"); - - Hashtable serviceList = new Hashtable(); - String signURL = ""; - Calendar c = Calendar.getInstance(); - - if (args.length == 0){ - - String delfile = Constants.RDFagentHome+Constants.SV_DELFILE_PATH; - Report.createFile(delfile); - -// DataMngr.delServiceSetByURL(signURL); - - - String url_path = Constants.RDFagentHome+Constants.SV_SIGN_URL_PATH; - - String filename = url_path+"_"+c.get(Calendar.DAY_OF_MONTH)+"_"+c.get(Calendar.MONTH); - Report.createFile(filename); - serviceList = DataMngr.getServices(filename); -/* }else if (args[0].equals("list")){ - serviceList = Communicator.readFromFile(args[1]); - - }else if (args[0].equals("sign")){ */ - }else{ - - signURL = args[0]; - serviceList = DataMngr.getServicesByURL(signURL); + signURL = args[0]; + serviceList = DataMngr.getServicesByURL(signURL); } - Enumeration list = serviceList.keys(); - while (list.hasMoreElements()){ - String ob = list.nextElement().toString(); - String val = serviceList.get(ob).toString(); - signURL = ob; - String servNames = val; - - Model model = Communicator.getServiceRDF(servNames,signURL); - - if (model.isEmpty()){ - Log.info("Model " +signURL+" is empty"); - - - }else{ - Report.add(" "); - Report.add("List of the processed services:"); - ServiceDescrParser sdParser = new ServiceDescrParser(model); - sdParser.getValidRDF(servNames,signURL); - - } - } -// } - if (args.length != 0){ - -// Report.send(signURL); - } - exit(signURL); - } + Enumeration list = serviceList.keys(); + while (list.hasMoreElements()) { + String ob = list.nextElement().toString(); + String val = serviceList.get(ob).toString(); + signURL = ob; + String servNames = val; + + Model model = Communicator.getServiceRDF(servNames, signURL); + + if (model.isEmpty()) { + Log.info("Model " + signURL + " is empty"); + failedServices.append("__PATTERN__" + signURL); // something unique + // that urls shouldnt + // have + } else { + Report.add(" "); + Report.add("List of the processed services:"); + ServiceDescrParser sdParser = new ServiceDescrParser(model); + sdParser.getValidRDF(servNames, signURL); + + } + exit(failedServices.toString()); + failedServices = new StringBuffer(); + } + // } + if (args.length != 0) { + // TODO this line sends email + //Report.send(signURL); + } + //exit(failedServices.toString()); + } - public static void exit(String signURL){ + public static void exit(String signURL) { DBConnector.closeConnection(); - + Log.stop(); - Date now = new Date(); - Report.doWrite(" STOP MOBY RDFAGENT REPORT "+now.toString()); - Report.add(" STOP MOBY RDFAGENT REPORT "+now.toString()); - - Report.doWrite("****************************************************************************************"); + Date now = new Date(); + Report.doWrite(" STOP MOBY RDFAGENT REPORT " + + now.toString()); + Report.add(" STOP MOBY RDFAGENT REPORT " + + now.toString()); + + Report + .doWrite("****************************************************************************************"); + + String[] failedURLs = signURL.split("__PATTERN__"); + for (int i = 0; i < failedURLs.length; i++) { + if (!failedURLs[i].equals("")) { + Log + .info("Sending an email to the individual identified by the following signature URL: " + + failedURLs[i]); + Report.send(failedURLs[i]); + } + } - Report.send(signURL); - System.exit(0); + //System.exit(0); } -} +} \ No newline at end of file =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Communicator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Communicator.java 2005/07/28 15:22:00 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/verifier/Communicator.java 2005/08/04 12:58:41 1.7 @@ -103,13 +103,13 @@ mes1 = "The request is for something forbidden."; } else if (code == 404) { Report - .doWrite("The server has not found anything matching the URI given"); + .doWrite("The server has not found anything matching the URL given"); Report .add("The server has not found anything matching the URI given"); mes1 = "The RDF file was not found on the server"; } else if (code == 417) { Report - .add(" RDF Parsing error. Possible reason being that multiple tags found in the same file."); + .add("RDF Parsing error. Possible reason being that multiple tags found in the same file."); mes1 = "RDF Parsing error. Possible reason being that multiple tags found in the same file."; } else if (code == 500) { Report.add(" Internal Error"); @@ -203,7 +203,6 @@ String from) { try { - Properties prop = new Properties(); prop.put("mail.smtp.host", Constants.MB_MAIL_SERVER); Session ses = Session.getDefaultInstance(prop, null); From kawas at pub.open-bio.org Thu Aug 4 08:58:41 2005 From: kawas at pub.open-bio.org (Eddie Kawas) Date: Thu Aug 4 09:49:38 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508041258.j74CwfA4008118@pub.open-bio.org> kawas Thu Aug 4 08:58:40 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util In directory pub.open-bio.org:/tmp/cvs-serv8093/org/biomoby/registry/rdfagent/util Modified Files: Report.java Log Message: The Agent, as far as i can tell, now works as expected. I will be changing the way that email is sent next. moby-live/Java/src/main/org/biomoby/registry/rdfagent/util Report.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/Report.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/registry/rdfagent/util/Report.java 2005/07/28 15:20:45 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/Report.java 2005/08/04 12:58:40 1.6 @@ -77,7 +77,10 @@ } String subject = "The RDFagent Report"; - Communicator.sendMail("ed.kawas@gmail.com",subject,message.toString(),Constants.MB_FROM); // send message to the service provider - that service was deregistered + Log.info("email message is\n" + message); + Communicator.sendMail(to,subject,message.toString(),Constants.MB_FROM); // send message to the service provider - that service was deregistered + ds = null; + mr = null; } } From gordonp at pub.open-bio.org Thu Aug 4 10:05:34 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Thu Aug 4 10:51:19 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508041405.j74E5Ygs008305@pub.open-bio.org> gordonp Thu Aug 4 10:05:34 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory pub.open-bio.org:/tmp/cvs-serv8280 Modified Files: MobyDataObject.java Added Files: MobyDataBoolean.java Log Message: Included Boolean as a primtive data type moby-live/Java/src/main/org/biomoby/shared/data MobyDataBoolean.java,NONE,1.1 MobyDataObject.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2005/07/22 05:11:54 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2005/08/04 14:05:34 1.5 @@ -138,6 +138,9 @@ else if("String".equals(objectClass)){ return new MobyDataString(objectTag); } + else if("Boolean".equals(objectClass)){ + return new MobyDataBoolean(objectTag); + } else if("DateTime".equals(objectClass)){ return new MobyDataDateTime(objectTag); } From gordonp at pub.open-bio.org Thu Aug 4 10:12:48 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Thu Aug 4 10:58:33 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508041412.j74ECmoF008366@pub.open-bio.org> gordonp Thu Aug 4 10:12:48 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv8341 Modified Files: SimpleClient.html Log Message: Made HTML anchors compliant to non-XML browsers, and added Boolean as a primitive moby-live/Java/docs SimpleClient.html,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 04:13:31 1.5 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 14:12:48 1.6 @@ -48,7 +48,7 @@
- +

Basic Anatomy of the Java API

Three main classes form the core of the API: @@ -79,7 +79,7 @@


- +

Hello World (or its bioinformatics equivalent)

@@ -112,7 +112,7 @@ A version of this code with comments and error checking is available in the MOBY CVS as Java/src/Clients/TestRequest.java


- +

Creating jMOBY Data

The Java API is designed so that all of the MOBY-S XML concepts can be "get" or "set" using Java primitives @@ -151,7 +151,7 @@

Creating a "primitive" data object

The following data are considered irreducible, atomic, or "primitive" in MOBY: - +

MOBY SpecificationjMOBY class in org.biomoby.shared.dataunderlying Java implementationCan be instantiated using any one of
ObjectMobyDataObjectimplements Comparable
  • "namespace", "id"
  • MOBYDataObject (cloning)
ObjectMobyDataObjectObject
  • "namespace", "id"
  • MOBYDataObject (cloning)
StringMobyDataStringjava.lang.StringBuffer
IntegerMobyDataIntjava.math.BigInteger
  • int
  • java.lang.Number (i.e. Byte, Double, Float, Integer, Long, Short, BigInteger, BigDecimal)
  • Strings like "2005"
FloatMobyDataFloatjava.math.BigDecimal
  • double
  • java.lang.Number
  • Strings like "2.0-e4" or "0.0002"
@@ -161,6 +161,7 @@ +
MOBY SpecificationjMOBY class in org.biomoby.shared.dataunderlying Java implementationCan be instantiated using any one of
StringMobyDataStringjava.lang.StringBuffer
IntegerMobyDataIntjava.math.BigInteger
  • int
  • java.lang.Number (i.e. Byte, Double, Float, Integer, Long, Short, BigInteger, BigDecimal)
  • Strings like "2005"
FloatMobyDataFloatjava.math.BigDecimal
  • double
  • java.lang.Number
  • Strings like "2.0-e4" or "0.0002"
BooleanMobyDataBooleanjava.lang.Boolean
  • Boolean
  • boolean
  • Strings "true" or "false"
DateTimeMobyDataDateTimejava.util.GregorianCalendar
@@ -191,7 +192,7 @@


- +

Manipulating jMOBY data

One does not only want to create data objects, but also retrieve information from them and edit them. @@ -234,7 +235,7 @@


- +

Creating MOBY XML (responses and queries)

It may at times be necessary to explicitly create a @@ -277,7 +278,7 @@ MobyDataUtils.toXMLDocument(System.out, queries);


- +

Parsing MOBY XML

As a counterpart to the utility above, jMOBY provides a method to deserialize a response/request envelope, useful if you are rolling your own server: @@ -293,7 +294,7 @@

Paul Gordon
-Last modified: Wed Aug 3 23:08:06 MDT 2005 +Last modified: Thu Aug 4 09:04:40 MDT 2005 From gordonp at pub.open-bio.org Thu Aug 4 11:46:50 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Thu Aug 4 12:32:43 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508041546.j74Fko8H008572@pub.open-bio.org> gordonp Thu Aug 4 11:46:49 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory pub.open-bio.org:/tmp/cvs-serv8547 Modified Files: MobyDataBytes.java Log Message: Made it easier to put data in (via URLs) and get data out (avoiding casts) for ease of use moby-live/Java/src/main/org/biomoby/shared/data MobyDataBytes.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.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/shared/data/MobyDataBytes.java 2005/05/19 15:57:26 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.java 2005/08/04 15:46:49 1.3 @@ -2,6 +2,7 @@ package org.biomoby.shared.data; import org.biomoby.shared.MobyDataType; +import java.io.*; /** * A convenience class generally intended for the transmission of @@ -20,6 +21,9 @@ private byte[] bytes; private static MobyDataType base64DataType; + /** How much is read from a input stream (e.g. file) at once */ + public static final int BYTE_READ_SIZE = 4096; + static{ base64DataType = new MobyDataType("text-base64"); } @@ -58,6 +62,36 @@ } /** + * C-tor to use when you want to encode a resource, such as an image file. + * + * @param resourceURL the URL of the resource to encode, such as "file:..." or "http:..." + */ + public MobyDataBytes(String name, java.net.URL resourceURL) throws IOException{ + super(name); + setDataType(base64DataType); + if(resourceURL == null){ + return; + } + InputStream inputStream = resourceURL.openStream(); + bytes = readStream(inputStream); + } + + protected byte[] readStream(InputStream in) throws IOException { + byte buffer[] = new byte[BYTE_READ_SIZE]; + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(buffer.length); + + while (true) { + int r = in.read(buffer); + if (r<=0) { + break; + } + byteStream.write(buffer, 0, r); + } + return byteStream.toByteArray(); + } + + + /** * Convenience method that returns an InputStream for use in image loaders, * file savers, etc. */ @@ -66,13 +100,20 @@ } /** - * @return byte[] representing the underlying data in this object + * @return byte[] representing the (mutable) underlying data in this object */ public Object getObject(){ return bytes; } /** + * The same as getObject, but doesn't require a cast of the result + */ + public byte[] getBytes(){ + return bytes; + } + + /** * This method base64 encodes the binary data held in this MOBY Object * if in service mode. */ From gordonp at pub.open-bio.org Thu Aug 4 11:48:35 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Thu Aug 4 12:34:19 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508041548.j74FmZw2008616@pub.open-bio.org> gordonp Thu Aug 4 11:48:35 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv8591 Modified Files: SimpleClient.html Log Message: Included binary data manipulation samples moby-live/Java/docs SimpleClient.html,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 14:12:48 1.6 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 15:48:35 1.7 @@ -190,6 +190,40 @@

+ +

Dealing with binary data

+

Because there is no byte array equivalent in MOBY, all binary data must be encoded as a text string. The +most used text encoding is Base64, and jMOBY contains a convenience +class (MobyDataBytes) that will encode and decode for you. For example, to create a +b64_encoded_gif using the URL based constructor: + +

+String imageLocation = "images/foo.gif";
+try{
+  MobyDataBytes encodedImage = new MobyDataBytes("myFavoriteImage", 
+                                                 getClass().getClassLoader().getResource(imageLocation));
+}catch(IOException ioe){
+  System.err.println("Could not load image data: " + ioe);
+}
+
+ +or to read the base64 encoded binary image data from a NCBI_Blast_XML_Gif: + +
+// Assume we have a MOBY NCBI_Blast_XML_Gif in the MobyComposite variable called "blastData"
+MobyDataBytes encodedImage = (MobyDataBytes) blastData.get("hitGraph");
+javax.swing.ImageIcon image = new ImageIcon(encodedImage.getBytes());
+
+

+ + +Not directly related to jMOBY, but note that ClassLoader.getResource(String) is a convenient +way in Java to create URLs appropriate to the context. For example, if the code was in a +jar or war, the response would +be "jar:bar.jar!images/foo.gif", in an application "file:images/foo.gif", in an applet +"http://www.applet.org/base/url/images/foo.gif", etc.. +

+
@@ -270,13 +304,22 @@

Create a MOBY XML response or query envelope with multiple invocations

Use the default constructor for MobyContentInstance, then add at least one MobyDataInstance -to it using the java.lang.Map interface or the convenient one-arg put method. To clarify, sending the content block to a service provider is requesting that a service acting on a gi namespace object be invoked for two separate input data. We are not calling a service that takes two MOBY Objects as input. +to it using the java.lang.Map interface or the convenient one-arg put method. To clarify, +sending the content block to a service provider is requesting that a service acting on a gi namespace +object be invoked for two separate input data. We are not calling a service that takes two MOBY Objects +as input.

 MobyContentInstance queries = new MobyContentInstance();
 data.put(new MobyDataObject("gi", "100089"));
 data.put(new MobyDataObject("gi", "324442"));
 MobyDataUtils.toXMLDocument(System.out, queries);
 
+ +The one argument put method essentially calls the standard Map.put(Object key, Object value) +method with an autogenerated unique key (corresponding to a MOBY queryID). As a service provider you would +always want to use the two argument put method to build a response object, as the keys MUST correspond +one-to-one with the queryIDs you received from the client. +


Parsing MOBY XML

@@ -294,7 +337,7 @@
Paul Gordon
-Last modified: Thu Aug 4 09:04:40 MDT 2005 +Last modified: Thu Aug 4 10:38:48 MDT 2005 From gordonp at pub.open-bio.org Thu Aug 4 12:27:57 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Thu Aug 4 13:54:16 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508041627.j74GRvha008735@pub.open-bio.org> gordonp Thu Aug 4 12:27:57 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv8710 Modified Files: SimpleClient.html Log Message: Incremental change moby-live/Java/docs SimpleClient.html,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 15:48:35 1.7 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 16:27:57 1.8 @@ -39,6 +39,7 @@
  • API Anatomy
  • Hello World
  • Creating jMOBY Data
  • +
  • Client/Server Communication (MobyRequest)
  • Manipulating jMOBY Data
  • Creating MOBY XML
  • Parsing MOBY XML
  • @@ -210,7 +211,7 @@ or to read the base64 encoded binary image data from a NCBI_Blast_XML_Gif:
    -// Assume we have a MOBY NCBI_Blast_XML_Gif in the MobyComposite variable called "blastData"
    +// Assume we have a MOBY NCBI_Blast_XML_Gif object in the MobyDataComposite variable called "blastData"
     MobyDataBytes encodedImage = (MobyDataBytes) blastData.get("hitGraph");
     javax.swing.ImageIcon image = new ImageIcon(encodedImage.getBytes());
     
    @@ -225,6 +226,14 @@


    + +

    Client/Server Communication (MobyRequest)

    + +

    +We have seen the MobyRequest class in the Hello World example -- it +invokes and sends data to a remote Web service. It can also be used by a service provider to parse an incoming +request and return the results. More info to come shortly... +

    Manipulating jMOBY data

    @@ -239,7 +248,7 @@ and extract the fields. Suppose we are a PSI-BLAST provider. We accept AminoAcidSequence:
    -//...receive data (see last section of this tutorial), a MobyDataInstance called "data"
    +// ...receive data, a MobyDataInstance called "data"
     if(! data.getDataType().getName().equals("AminoAcidSequence")){
        throw new MobyException("Expected an AminoAcidSequence, but instead found " + data.getDataType());
     }
    @@ -328,7 +337,7 @@
     
     MobyContentInstance queries = MobyDataUtils.fromXMLDocument(System.in);
     System.out.println("The document contained " + ((queries.size() == 1) ? "1 query" : (query.size() + " queries")));
    -//Use the HashMap functions to retrieve individual queries...
    +// Use the HashMap functions to retrieve individual queries...
     

    @@ -337,7 +346,7 @@
    Paul Gordon
    -Last modified: Thu Aug 4 10:38:48 MDT 2005 +Last modified: Thu Aug 4 11:22:27 MDT 2005 From senger at pub.open-bio.org Sun Aug 7 02:29:58 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 7 03:16:08 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508070629.j776TwDc017218@pub.open-bio.org> senger Sun Aug 7 02:29:58 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv17199 Modified Files: Central.java Added Files: MobyResourceRef.java Log Message: moby-live/Java/src/main/org/biomoby/shared MobyResourceRef.java,NONE,1.1 Central.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Central.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/Central.java 2005/07/19 12:39:59 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Central.java 2005/08/07 06:29:58 1.11 @@ -8,6 +8,7 @@ package org.biomoby.shared; import java.util.Map; +import java.io.InputStream; /** * An interface to the Moby Registry.

    @@ -66,6 +67,37 @@ * Object_A in one or more copies. */ static final int iHAS = 3; + /** A name of an ontology describing registered service types. + The name is used in a hash table returned by the {@link + #getResourceURLs}. + */ + static final String SERVICE_TYPES_RESOURCE_NAME = "Service"; + + /** A name of an ontology describing registered service types. + The name is used in a hash table returned by the {@link + #getResourceURLs}. + */ + static final String SERVICE_INSTANCES_RESOURCE_NAME = "ServiceInstance"; + + /** A name of an ontology describing registered data types. The + name is used in a hash table returned by the {@link + #getResourceURLs}. + */ + static final String DATA_TYPES_RESOURCE_NAME = "Object"; + + /** A name of an ontology describing registered service types. + The name is used in a hash table returned by the {@link + #getResourceURLs}. + */ + static final String NAMESPACES_RESOURCE_NAME = "Namespace"; + + /** A name of an ontology describing all registered entities. The + name is used in a hash table returned by the {@link + #getResourceURLs}. The contents returned by this method for + this ontology name is a concatanation of all other ontologies. + */ + static final String FULL_RESOURCE_NAME = "Full"; + /************************************************************************** * Get a (redundant) list of all registered service names.

    * @@ -393,4 +425,50 @@ *************************************************************************/ String getRegistryNamespace(); + /************************************************************************** + * Get URLs (and content types) of RDF documents describing + * various BioMoby ontologies. These RDF documents are yet another + * form how to get information about registered entities in the + * BioMoby registry.

    + * + * There are five possible ontology names: + * {@link #SERVICE_TYPES_RESOURCE_NAME}, + * {@link #DATA_TYPES_RESOURCE_NAME}, + * {@link #NAMESPACES_RESOURCE_NAME}, + * {@link #SERVICE_INSTANCES_RESOURCE_NAME}, + * {@link #FULL_RESOURCE_NAME}.

    + * + * @return an array of references to RDF documents; some elements + * of this array may refer to the same resources but + * stored/available in a different content type (this mostly means + * that some of them may be compressed to get them faster) + * + * @throws MobyException if communication with the Moby Registry fails + *************************************************************************/ + MobyResourceRef[] getResourceRefs() + throws MobyException; + + /************************************************************************** + * First get (from a BioMoby registry) a URL for the given + * 'resourceName' and then retrieve a document from this URL. If + * the resource is available in a compressed format, return it + * uncompressed.

    + * + * The document is in RDF and represents some (or all) entities + * registered in the BioMoby registry.

    + * + * @param resourceName is an ontology name (must be one of these: + * {@link #SERVICE_TYPES_RESOURCE_NAME}, {@link + * #DATA_TYPES_RESOURCE_NAME}, {@link #NAMESPACES_RESOURCE_NAME}, + * {@link #SERVICE_INSTANCES_RESOURCE_NAME}, {@link + * #FULL_RESOURCE_NAME}) + * + * @return an input stream that contains an RDF document + * @throws MobyException if communication with the Moby Registry + * fails, or if communication with the resource URL fails + *************************************************************************/ + InputStream getResource (String resourceName) + throws MobyException; + + } From senger at pub.open-bio.org Sun Aug 7 02:30:24 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 7 03:16:23 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508070630.j776UOq1017266@pub.open-bio.org> senger Sun Aug 7 02:30:23 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory pub.open-bio.org:/tmp/cvs-serv17247 Modified Files: CentralImpl.java Log Message: moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.22,1.23 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/07/19 12:39:58 1.22 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/08/07 06:30:23 1.23 @@ -12,6 +12,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; +import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; @@ -38,6 +39,7 @@ import org.biomoby.shared.NoSuccessException; import org.biomoby.shared.PendingCurationException; import org.biomoby.shared.Utils; +import org.biomoby.shared.MobyResourceRef; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -1626,4 +1628,78 @@ return uri; } + /************************************************************************** + * Parses and imports the following XML. + *

    +     * <resourceURLs>
    +     *   <Resource name="Service"         url="..." type="..."/>
    +     *   <Resource name="Object"          url="..." type="..."/>
    +     *   <Resource name="Namespace"       url="..." type="..."/>
    +     *   <Resource name="ServiceInstance" url="..." type="..."/>
    +     *   <Resource name="Full"            url="..." type="..."/>
    +     * </resourceURLs>
    +     * 
    + *************************************************************************/ + public MobyResourceRef[] getResourceRefs() + throws MobyException { + + String cacheId = "retrieveResourceURLs"; + MobyResourceRef[] cachedResults = (MobyResourceRef[])getContents (cacheId); + if (cachedResults != null) + return cachedResults; + + String result = (String)doCall ("retrieveResourceURLs", + new Object[] {}); + + // parse returned XML + Vector v = new Vector(); + Document document = null; + try { + document = docBuilder.parse (new ByteArrayInputStream (result.getBytes())); + } catch (Exception e) { + throw new MobyException(e.toString()); + } + + NodeList list = document.getElementsByTagName ("Resource"); + for (int i = 0; i < list.getLength(); i++) { + Element elem = (Element)list.item (i); + try { + v.addElement + (new MobyResourceRef (elem.getAttribute ("name"), + new URL ((String)elem.getAttribute ("url")), + elem.getAttribute ("type"))); + } catch (MalformedURLException e2) { + if (debug) + System.err.println ("Bad URL: " + elem.getAttribute ("url")); + } + } + + MobyResourceRef[] results = new MobyResourceRef [v.size()]; + v.copyInto (results); + + // Add this data to the cache in case we get called again + setContents (cacheId, results); + + return results; + } + + /************************************************************************** + * + *************************************************************************/ + public InputStream getResource (String resourceName) + throws MobyException { + + MobyResourceRef[] resourceRefs = getResourceRefs(); + for (int i = 0; i < resourceRefs.length; i++) { + if (resourceName.equalsIgnoreCase (resourceRefs[i].getResourceName())) { + URL url = resourceRefs[i].getResourceLocation(); + try { + return url.openStream(); + } catch (java.io.IOException e2) { + throw new MobyException (e2.toString()); + } + } + } + throw new MobyException ("No resource found for '" + resourceName + "'."); + } } From senger at pub.open-bio.org Sun Aug 7 02:30:49 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 7 03:16:32 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508070630.j776Unbl017309@pub.open-bio.org> senger Sun Aug 7 02:30:49 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Clients In directory pub.open-bio.org:/tmp/cvs-serv17290 Modified Files: MobyCmdLineClient.java Log Message: moby-live/Java/src/Clients MobyCmdLineClient.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java 2005/07/19 12:39:58 1.9 +++ /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java 2005/08/07 06:30:49 1.10 @@ -90,6 +90,16 @@ } // + // no other arguments => say what endpoint and URI are in used + // + if (cmd.params.length == 0) { + decoration ("Registry endpoint: "); + System.out.println (worker.getRegistryEndpoint()); + decoration ("Registry namespace: "); + System.out.println (worker.getRegistryNamespace()); + } + + // // simple retrieval of various sets // if (cmd.hasOption ("-ls")) { @@ -167,6 +177,16 @@ } } + if (cmd.hasOption ("-lu")) { + decorationLn ("Resource URLs:"); + decorationLn ("--------------"); + MobyResourceRef[] resourceRefs = worker.getResourceRefs(); + for (int i = 0; i < resourceRefs.length; i++) { + System.out.println (resourceRefs[i].getResourceName()); + System.out.println ("\t" + resourceRefs[i].getResourceLocation()); + } + } + // // retrieval of more complex entities // @@ -218,6 +238,25 @@ "\n")); } + if ((param = cmd.getParam ("-rdf")) != null ) { + String resourceName = null; + if (param.startsWith ("st")) resourceName = Central.SERVICE_TYPES_RESOURCE_NAME; + else if (param.startsWith ("dt")) resourceName = Central.DATA_TYPES_RESOURCE_NAME; + else if (param.startsWith ("se")) resourceName = Central.SERVICE_INSTANCES_RESOURCE_NAME; + else if (param.startsWith ("na")) resourceName = Central.NAMESPACES_RESOURCE_NAME; + else if (param.startsWith ("f")) resourceName = Central.FULL_RESOURCE_NAME; + if (resourceName != null) { + decorationLn ("RDF for '" + resourceName + "':"); + decorationLn ("-------"); + BufferedReader in = + new BufferedReader (new InputStreamReader (worker.getResource (resourceName))); + String inputLine; + while ((inputLine = in.readLine()) != null) + System.out.println (inputLine); + in.close(); + } + } + // // registrations of various entities // From senger at pub.open-bio.org Sun Aug 7 02:31:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 7 03:16:36 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508070631.j776V3a3017352@pub.open-bio.org> senger Sun Aug 7 02:31:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Clients/help In directory pub.open-bio.org:/tmp/cvs-serv17333/help Modified Files: MobyCmdLineClient_usage.txt Log Message: moby-live/Java/src/Clients/help MobyCmdLineClient_usage.txt,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Clients/help/MobyCmdLineClient_usage.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/Clients/help/MobyCmdLineClient_usage.txt 2005/07/19 12:39:58 1.8 +++ /home/repository/moby/moby-live/Java/src/Clients/help/MobyCmdLineClient_usage.txt 2005/08/07 06:31:03 1.9 @@ -1,10 +1,15 @@ Usage: run-cmdline-client -h[elp] + run-cmdline-client [] run-cmdline-client [] or run-any-client MobyCmdLineClient -h[elp] + run-any-client MobyCmdLineClient [] run-any-client MobyCmdLineClient [] +(If run without any arguments or only with , then it +prints the registry's endpoint and namespace that is going to be used.) + where specify what Moby registry to connect to: -e @@ -24,6 +29,7 @@ -lt ... list names and descriptions of all service types -ln ... list names and descriptions of all namespaces -ld ... list names and descriptions of all data types + -lu ... list URLs of RDF documents describing this registry To get entities by their names: @@ -36,6 +42,8 @@ (note that the parameter has two parts delimited by a comma) -data print definition of given data type + -rdf [stypes | dtypes | services | namespaces | full] + print RDF resource of the given contents To get ontological relationships of given entities: From senger at pub.open-bio.org Sun Aug 7 02:36:33 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 7 03:22:25 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508070636.j776aX0v017401@pub.open-bio.org> senger Sun Aug 7 02:36:33 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv17378 Modified Files: ChangeLog index.html Log Message: moby-live/Java/docs ChangeLog,1.32,1.33 index.html,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/07/22 05:16:08 1.32 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/07 06:36:33 1.33 @@ -1,3 +1,11 @@ +2005-08-07 Martin Senger + + * Added methods to Central.java for getting URLs of the RDF + registry resources, and for getting resources themselves. + + * Added new options to MobyCmdLineClient dealing with registry's + endpoint and its namespace, and with getting RDF resources. + 2005-07-21 Paul Gordon * Update of data instance code to fully functional status (pending minor changes to the MOBY-S API docs) =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/docs/index.html 2005/05/19 20:18:53 1.11 +++ /home/repository/moby/moby-live/Java/docs/index.html 2005/08/07 06:36:33 1.12 @@ -66,11 +66,17 @@

    Acknowledgements

    -The work on BioMoby Java sub-project is partly supported by -myGrid, +The work on BioMoby Java sub-project is funded from various sources, +depending mostly on the individuals involved: +

    Other parts of jMoby are funded from the same sources as the BioMoby @@ -82,7 +88,7 @@

    Martin Senger
    -Last modified: Thu May 19 18:54:56 2005 +Last modified: Sun Aug 7 15:04:18 2005
    From senger at pub.open-bio.org Sun Aug 7 02:40:39 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 7 03:26:38 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508070640.j776edux017480@pub.open-bio.org> senger Sun Aug 7 02:40:39 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv17453 Modified Files: Central.java Log Message: moby-live/Java/src/main/org/biomoby/shared Central.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Central.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Central.java 2005/08/07 06:29:58 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Central.java 2005/08/07 06:40:39 1.12 @@ -69,32 +69,32 @@ /** A name of an ontology describing registered service types. The name is used in a hash table returned by the {@link - #getResourceURLs}. + #getResourceRefs}. */ static final String SERVICE_TYPES_RESOURCE_NAME = "Service"; /** A name of an ontology describing registered service types. The name is used in a hash table returned by the {@link - #getResourceURLs}. + #getResourceRefs}. */ static final String SERVICE_INSTANCES_RESOURCE_NAME = "ServiceInstance"; /** A name of an ontology describing registered data types. The name is used in a hash table returned by the {@link - #getResourceURLs}. + #getResourceRefs}. */ static final String DATA_TYPES_RESOURCE_NAME = "Object"; /** A name of an ontology describing registered service types. The name is used in a hash table returned by the {@link - #getResourceURLs}. + #getResourceRefs}. */ static final String NAMESPACES_RESOURCE_NAME = "Namespace"; /** A name of an ontology describing all registered entities. The name is used in a hash table returned by the {@link - #getResourceURLs}. The contents returned by this method for - this ontology name is a concatanation of all other ontologies. + #getResourceRefs}. The contents returned by this method for + this ontology name is a concatenation of all other ontologies. */ static final String FULL_RESOURCE_NAME = "Full"; From mwilkinson at pub.open-bio.org Sun Aug 7 06:01:39 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sun Aug 7 06:47:03 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508071001.j77A1dO3027160@pub.open-bio.org> mwilkinson Sun Aug 7 06:01:39 EDT 2005 Update of /home/repository/moby/moby-live/Database In directory pub.open-bio.org:/tmp/cvs-serv27145 Added Files: Update_DB_085_to_086.pl Log Message: a migration script to move the Object database into the new 0.86 API moby-live/Database Update_DB_085_to_086.pl,NONE,1.1 From gordonp at pub.open-bio.org Sun Aug 7 19:41:40 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Sun Aug 7 20:28:18 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508072341.j77Nfe2J028943@pub.open-bio.org> gordonp Sun Aug 7 19:41:40 EDT 2005 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv28918 Modified Files: build.xml Log Message: Remoived Java 1.5 dependency for decomposition classes, since they have been partially reimplemented moby-live/Java build.xml,1.17,1.18 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- /home/repository/moby/moby-live/Java/build.xml 2005/07/19 12:39:58 1.17 +++ /home/repository/moby/moby-live/Java/build.xml 2005/08/07 23:41:40 1.18 @@ -77,7 +77,7 @@ + value=""/> &libraries; @@ -207,7 +207,8 @@ From gordonp at pub.open-bio.org Sun Aug 7 19:46:12 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Sun Aug 7 20:31:40 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508072346.j77NkCqL029021@pub.open-bio.org> gordonp Sun Aug 7 19:46:12 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory pub.open-bio.org:/tmp/cvs-serv28953/src/main/org/biomoby/shared/data Modified Files: MobyDataObject.java Log Message: Update of code and documentation for asynchronous calls to MobyRequest moby-live/Java/src/main/org/biomoby/shared/data MobyDataObject.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.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/shared/data/MobyDataObject.java 2005/08/04 14:05:34 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2005/08/07 23:46:12 1.6 @@ -32,7 +32,7 @@ */ public class MobyDataObject extends MobyPrimaryDataSimple implements MobyDataInstance, Cloneable, Comparable{ - protected int xmlMode = MobyDataInstance.SERVICE_XML_MODE; + protected int xmlMode = MobyDataInstance.CENTRAL_XML_MODE; private Object object = new Object(); private Vector CRIBVector = null; // CrossReference Info Block from the MOBY-S API private MobyProvisionInfo provisionInfo = null; // Provision Info Block from MOBY-S API @@ -65,7 +65,7 @@ * Constructor convenient for a base object with a namespace and ID. */ public MobyDataObject(String namespace, String id){ - super(); + super(""); setDataType(staticObjectDataType); setId(id); addNamespace(new MobyNamespace(namespace)); From gordonp at pub.open-bio.org Sun Aug 7 19:46:12 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Sun Aug 7 20:32:24 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508072346.j77NkCEo029001@pub.open-bio.org> gordonp Sun Aug 7 19:46:12 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory pub.open-bio.org:/tmp/cvs-serv28953/src/main/org/biomoby/client Modified Files: MobyRequest.java Added Files: MobyRequestEvent.java MobyRequestEventHandler.java Log Message: Update of code and documentation for asynchronous calls to MobyRequest moby-live/Java/src/main/org/biomoby/client MobyRequestEvent.java,NONE,1.1 MobyRequestEventHandler.java,NONE,1.1 MobyRequest.java,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.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/client/MobyRequest.java 2005/07/22 05:23:00 1.14 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2005/08/07 23:46:12 1.15 @@ -21,20 +21,9 @@ import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; -import org.biomoby.shared.Central; -import org.biomoby.shared.MobyData; +import org.biomoby.shared.*; import org.biomoby.shared.data.*; -import org.biomoby.shared.MobyException; -import org.biomoby.shared.MobyPrefixResolver; -import org.biomoby.shared.MobyService; -import org.biomoby.shared.NoSuccessException; -import org.biomoby.shared.SOAPException; -import org.w3c.dom.CDATASection; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; +import org.w3c.dom.*; /** * This class handles the WSDL transaction to request a response @@ -76,6 +65,12 @@ private XPath simpleChildXPath; private XPath collectionChildXPath; + private int autoID = 0; + + // Used as invocation callback if MobyRequest is acting as a server, + // or is executing services as a client asynchronously + private Vector eventHandlers; + /** * Default constructor. You should have a Central instance around since you're going to * be retrieving MobyServices to pass into here. Lets reuse it. @@ -87,6 +82,8 @@ mobyCentral = central; wsdlCache = new Hashtable(); + eventHandlers = new Vector(); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); docBuilder = dbf.newDocumentBuilder(); @@ -252,7 +249,7 @@ */ public MobyContentInstance invokeService() throws Exception, MobyException, SOAPException, NoSuccessException{ if(mobyService == null){ - throw new MobyException("Tries to invoke null service from MobyRequest (call setService first)"); + throw new MobyException("Tried to invoke null service from MobyRequest (call setService first)"); } getServiceFromWSDL(); @@ -265,6 +262,61 @@ } /** + * Asynchronous call to invokeService. A callback to the passed-in handler will be made when + * the response is ready, or there is an exception. + * + * @return the id that the callback event will return from getID(), allowing a client to distinguish between multiple concurrent invocation callbacks + */ + public synchronized int invokeService(MobyRequestEventHandler handler){ + int id = autoID++; + + Thread t = new InvocationThread(this, handler, id); // see internal class definition below + t.start(); + + return id; + } + + // This is the class that asynchronously calls the service and does a callback to + // the handler specified in the invocation. + class InvocationThread extends Thread { + MobyRequest mobyRequest; + MobyRequestEventHandler handler; + int requestId; + + InvocationThread(MobyRequest mr, MobyRequestEventHandler h, int id){ + mobyRequest = mr; + handler = h; + requestId = id; + } + + public void run() { + MobyContentInstance content = null; + MobyRequestEvent responseEvent = null; + try{ + content = mobyRequest.invokeService(); + }catch(Exception e){ + responseEvent = new MobyRequestEvent(content, mobyRequest, e, requestId); + } + if(responseEvent == null){ + responseEvent = new MobyRequestEvent(content, mobyRequest, null, requestId); + } + handler.processEvent(responseEvent); + } + } + + public void addEventHandler(MobyRequestEventHandler h){ + eventHandlers.add(h); + } + + public void removeEventHandler(MobyRequestEventHandler h){ + eventHandlers.remove(h); + } + + public void sendResponse(MobyRequestEvent mre){ + // Not yet implemented, need to conform to some web.xml specification here... + } + + /** * @throws MobyException if the number of input parameters was wrong, or the paramters were of the wrong type. */ protected void verifyInput() throws MobyException{ @@ -644,7 +696,7 @@ } /** - * A method that sets up the execution environm,ent for and runs a compiled XPath statement against a DOM node + * A method that sets up the execution environment for and runs a compiled XPath statement against a DOM node * You should call releaseXPath when you're done with the results * @return the list of Nodes that satisfy the XPath in this Node's context */ From gordonp at pub.open-bio.org Sun Aug 7 19:46:12 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Sun Aug 7 20:32:35 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508072346.j77NkCLi028982@pub.open-bio.org> gordonp Sun Aug 7 19:46:11 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv28953/docs Modified Files: ChangeLog SimpleClient.html Log Message: Update of code and documentation for asynchronous calls to MobyRequest moby-live/Java/docs ChangeLog,1.33,1.34 SimpleClient.html,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/07 06:36:33 1.33 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/07 23:46:11 1.34 @@ -1,3 +1,11 @@ +2005-08-07 Paul Gordon + + * Added asynchronous mode to MobyRequest, so clients get callbacks when + results are ready (not to be confused with asynchronous calls at the + MOBY protocol level). + + * Web site documentation update for client/server quickstart. + 2005-08-07 Martin Senger * Added methods to Central.java for getting URLs of the RDF =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/04 16:27:57 1.8 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/07 23:46:11 1.9 @@ -14,11 +14,13 @@ This document is intended to get you up and running using the client-server service communication code (i.e. calling or providing remote Web Services) in the Java implementation (jMOBY) of - MOBY-S "Web Services for Molecular Biology". If you are looking + MOBY-S "Web Services for Molecular Biology". + This document assumes that you are familiar with Java and + XML. + If you are looking for more detailed information on how to query MOBY Central's yellow pages about what services are available, please see this - document. This document assumes that you are familiar with Java and - XML. + document.

    Syntax Notes

    @@ -87,7 +89,8 @@ The following code has two parts. First, a service called "MOBYSHoundGetGenBankff" is found via MOBY Central. This service fetches sequences based on keys such as GenBank gi identifiers. Second, the service is called using MobyRequest with a sample input MobyDataObject. The result of the - service invocation (a DNA sequence in XML) is printed. + service invocation (a DNA sequence record in + Genbank flat file format) is printed.
                
    @@ -143,7 +146,7 @@
       which is then visualized or submitted to other services.  All MOBY objects have 
     a namespace and an ID, 
     therefore a database identifier is the simplest form of a object.  A MobyDataObject constructor is available
    -to easily build database identifiers (MobyDataObject(String namespace, String id)):
    +to easily build database identifiers, MobyDataObject(String namespace, String id):
     
     
    MobyDataObject dbid = new MobyDataObject("NCBI_gi", "111076");
    @@ -155,15 +158,15 @@ - + - - - - - - + + + + + +
    MOBY SpecificationjMOBY class in org.biomoby.shared.dataunderlying Java implementationCan be instantiated using any one of
    MOBY SpecificationjMOBY class in org.biomoby.shared.dataunderlying Java implementationCan be instantiated using any one of
    ObjectMobyDataObjectObject
    • "namespace", "id"
    • MOBYDataObject (cloning)
    StringMobyDataStringjava.lang.StringBuffer
    IntegerMobyDataIntjava.math.BigInteger
    • int
    • java.lang.Number (i.e. Byte, Double, Float, Integer, Long, Short, BigInteger, BigDecimal)
    • Strings like "2005"
    FloatMobyDataFloatjava.math.BigDecimal
    • double
    • java.lang.Number
    • Strings like "2.0-e4" or "0.0002"
    BooleanMobyDataBooleanjava.lang.Boolean
    • Boolean
    • boolean
    • Strings "true" or "false"
    DateTimeMobyDataDateTimejava.util.GregorianCalendar
    ObjectMobyDataObjectObject
    • "namespace", "id"
    • MOBYDataObject (cloning)
    StringMobyDataStringjava.lang.StringBuffer
    IntegerMobyDataIntjava.math.BigInteger
    • int
    • java.lang.Number (i.e. Byte, Double, Float, Integer, Long, Short, BigInteger, BigDecimal)
    • Strings like "2005"
    FloatMobyDataFloatjava.math.BigDecimal
    • double
    • java.lang.Number
    • Strings like "2.0-e4" or "0.0002"
    BooleanMobyDataBooleanjava.lang.Boolean
    • Boolean
    • boolean
    • Strings "true" or "false"
    DateTimeMobyDataDateTimejava.util.GregorianCalendar
    Any object can also be instantiated using the corresponding XML data as an org.w3c.dom.Element. @@ -172,9 +175,10 @@
    MobyDataString sequenceString = new MobyDataString("MPGGFILAIDEGTTSARAIIYNQDLEVLGIGQYDFPQHYPSPGYVEHNPDEIWNAQMLAI");
    MobyDataInt sequenceLength = new MobyDataInt(60);
    MobyDataFloat sequencePI = new MobyDataFloat(3.67);
    -
    MobyDataFloat sequenceBlastEValue = new MobyDataFloat("1e-29");
    +
    MobyDataFloat sequenceBlastEValue = new MobyDataFloat("1e-29");
    +
    MobyDataBoolean isRepetitive = new MobyDataBoolean(false);
    MobyDataDateTime blastDBUpdated = new MobyDataDateTime("2005-03-24");
    -
    +
    MobyDataDateTime now = new MobyDataDateTime(Calendar.getInstance());

    Creating composite objects

    @@ -195,7 +199,7 @@

    Dealing with binary data

    Because there is no byte array equivalent in MOBY, all binary data must be encoded as a text string. The most used text encoding is Base64, and jMOBY contains a convenience -class (MobyDataBytes) that will encode and decode for you. For example, to create a +class (MobyDataBytes) that will encode and decode for you. For example, to create a b64_encoded_gif using the URL based constructor:

    @@ -230,9 +234,57 @@
     

    Client/Server Communication (MobyRequest)

    -We have seen the MobyRequest class in the Hello World example -- it -invokes and sends data to a remote Web service. It can also be used by a service provider to parse an incoming -request and return the results. More info to come shortly... +We have seen the MobyRequest class in the HelloMOBY example -- it +synchronously sent data to a remote Web service and waited for a response. This class can also work +asynchronously, +performing a callback to a MobyRequestEventHandler when the response is available. +Let's recode (available in the CVS Client directory) +the HelloMOBY example to work asynchronously: + +

    +import org.biomoby.client.*;
    +import org.biomoby.shared.*;
    +import org.biomoby.shared.data.*;
    +
    +public class HelloMOBY2 implements MobyRequestEventHandler{
    +    public static void main(String[] args) throws Exception{
    +
    +	Central worker = new CentralImpl();
    +	MobyService templateService = new MobyService("MOBYSHoundGetGenBankff");
    +        MobyService[] validServices = worker.findService(templateService);
    +
    +	MobyRequest mr = new MobyRequest(worker);
    +	mr.setService(validServices[0]);
    +	mr.setInput(new MobyDataObject("NCBI_gi", "111076"));
    +
    +	// HelloMOBY2 (ourselves) is a valid listener, must use "new" to
    +	// have a non-static reference for callback
    +	mr.invokeService(new HelloMOBY2());
    +
    +	// Infinite loop broken only by exit in callback function
    +	while(true){
    +	   System.err.print("."); // Print a dot every second (poor man's text hourglass)
    +	   try{Thread.sleep(100);}catch(InterruptedException ie){}
    +	}
    +    }
    +
    +    // Called by MobyRequest when the response is available
    +    public void processEvent(MobyRequestEvent mre){
    +	System.out.println("");	 // Blank line to seperate response from hourglass dots
    +	System.out.println(mre.getContent().toString());
    +	System.exit(0);
    +    }
    +}
    +
    + +

    + +

    + +It can also be used by a service +provider to parse an incoming request and return the results. + +More info to come shortly...

    @@ -262,8 +314,9 @@

    The getObject method allows the user to retrieve the underlying internal representation of the MOBY data in any MobyDataInstance. The returned Object can be safely cast as listed in the primitives table above, MobyDataComposite -uses a HashMap, MobyDataObjectSet uses a Vector. Modifying mutable returned -object modifies the MobyDataObject from which it came. For example, building on the previous example: +uses a HashMap, MobyDataObjectSet uses a Vector. Modifying a mutable returned +object (from MobyString, MobyDateTime, or MobyDataBytes) modifies the +MobyDataObject from which it came. For example, building on the previous example:

     StringBuffer mutableSequence = (StringBuffer) ((MobyDataString) data.get("SequenceString")).getObject();
    @@ -274,7 +327,17 @@
     
    This would print the sequence XML, with the first three letters of the sequence string being "XXX". Note that you do have to do some casting to get all of these data right. When jMOBY requires Java 1.5, we can get rid of several of these cast annoyances by using the Generics construct. +

    + +

    For classes with unmutable underlying objects (MobyDataInt, MobyDataFloat, and MobyDataBoolean), methods have been added to modify the object values rather than having to build new ones. For example: + +

    +mobyBooleanObject.setValue(true);
    +mobyFloatObject.divide(Math.PI);
    +mobyIntObject.add(new Integer(2));
    +
    +The math functions have been written to maintain as much numerical precision as possible.


    @@ -346,7 +409,7 @@
    Paul Gordon
    -Last modified: Thu Aug 4 11:22:27 MDT 2005 +Last modified: Sun Aug 7 18:34:57 MDT 2005 From gordonp at pub.open-bio.org Sun Aug 7 19:51:06 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Sun Aug 7 20:36:30 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508072351.j77Np6VP029073@pub.open-bio.org> gordonp Sun Aug 7 19:51:06 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Clients In directory pub.open-bio.org:/tmp/cvs-serv29052/src/Clients Added Files: HelloMOBY.java HelloMOBY2.java Log Message: Example class used in the Client/Server Quickstart document moby-live/Java/src/Clients HelloMOBY.java,NONE,1.1 HelloMOBY2.java,NONE,1.1 From gordonp at pub.open-bio.org Tue Aug 9 15:40:57 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Tue Aug 9 16:27:06 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508091940.j79JevpN003924@pub.open-bio.org> gordonp Tue Aug 9 15:40:56 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv3899 Modified Files: SimpleClient.html Log Message: Added Comparable docs, and fixed typos in sequence object composition code moby-live/Java/docs SimpleClient.html,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/07 23:46:11 1.9 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/09 19:40:56 1.10 @@ -190,8 +190,8 @@
     String aaSequence = "MPGGFILAIDEGTTSARAIIYNQDLEVLGIGQYDFPQHYPSPGYVEHNPDEIWNAQMLAI";
     MobyDataComposite aaSequenceObject = new MobyDataComposite("AminoAcidSequence");
    -aaSequence.put("SequenceString", new MobyDataString(aaSequence));
    -aaSequence.put("Length", new MobyDataInt(aaSequence.length()));
    +aaSequenceObject.put("SequenceString", new MobyDataString(aaSequence));
    +aaSequenceObject.put("Length", new MobyDataInt(aaSequence.length()));
     

    @@ -340,6 +340,18 @@ The math functions have been written to maintain as much numerical precision as possible.

    +

    Comparing Objects

    +

    +Another convenient thing about the jMOBY objects is that they implement the +java.lang.Comparable interface. +They have implemented the equals and compareTo methods to be +much more forgiving than the underlying data types, which throw exceptions at comparison with anything +but their own class. Any object in the jMOBY hierarchy can be compared to any other. +If objects values are the same (e.g. the String 2.0 and the float 2.0), the namespace and ID +are used to sort. This sorting implementation is very convenient for putting the objects +into tabular format. +

    +

    Creating MOBY XML (responses and queries)

    From mng at pub.open-bio.org Tue Aug 9 18:23:47 2005 From: mng at pub.open-bio.org (michael ng) Date: Tue Aug 9 19:10:35 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508092223.j79MNlfo004211@pub.open-bio.org> mng Tue Aug 9 18:23:47 EDT 2005 Update of /home/repository/moby/moby-live/Accessories In directory pub.open-bio.org:/tmp/cvs-serv4185 Modified Files: code-generator0.6.cgi Added Files: help.cgi Log Message: updated help.cgi moby-live/Accessories help.cgi,NONE,1.1 code-generator0.6.cgi,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi 2005/08/05 20:32:43 1.2 +++ /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi 2005/08/09 22:23:46 1.3 @@ -2151,8 +2151,8 @@ - HTML Wrapper [?] - Command Line [?] + HTML Wrapper [?] + Command Line [?]
    @@ -2202,14 +2202,17 @@ my $service_html =""; my $service_html2 =""; - + my $temp = ""; + +javascript_functions(); #For the HTML Wrapper, the program will ask user to provide the location of their Service URL #For the Command Line, the program will ask user to provide the command with the variable names in order to execute the program if ($htmlORcom eq "htmlWrapper"){ - $service_html = "Service URL :"; + $service_html = 'Service URL'; + $temp = 'http://'; } else{ - $service_html = "Command Line:"; + $service_html = 'Command Line'; $service_html2 = "
    Note: Please provide a name (eg. var1) for each of the mapping variable in the Command"; } @@ -2250,11 +2253,11 @@
    - - + + - +
    $service_html http://[?]
    $service_html :$temp[?]
    Number of Input Parameters: [?]
    [?]
    From mng at pub.open-bio.org Fri Aug 5 16:32:44 2005 From: mng at pub.open-bio.org (michael ng) Date: Mon Aug 15 11:29:38 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508052032.j75KWihh012856@pub.open-bio.org> mng Fri Aug 5 16:32:43 EDT 2005 Update of /home/repository/moby/moby-live/Accessories In directory pub.open-bio.org:/tmp/cvs-serv12830 Modified Files: code-generator0.6.cgi Log Message: code-generator0.6 with data confirmation page moby-live/Accessories code-generator0.6.cgi,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi 2005/07/29 20:06:37 1.1 +++ /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi 2005/08/05 20:32:43 1.2 @@ -7,7 +7,6 @@ # #******************************************************************************** - use strict; use LWP::UserAgent; use LWP::Simple; @@ -27,12 +26,8 @@ my @InParam; #Different forms that will be displayed -if ( $query->param("Webservice Properties")) -{ - print $query->header(); - webservice_properties(); -} -elsif ( $query->param("Submit") ) + +if ( $query->param("Submit") ) { print $query->header(); validate_form(); @@ -77,40 +72,15 @@ print $query->header(); deregister_service(); } -elsif ( $query->param("MapHTMLinput") ) -{ - print $query->header(); - MapHTMLinput(); -} -elsif ( $query->param("MapHTMLinput2") ) -{ - print $query->header(); - MapHTMLinput2(); -} -elsif ( $query->param("mapSQLinput") ) -{ - print $query->header(); - mapSQLinput(); -} -elsif ( $query->param("mapSQLfields") ) -{ - print $query->header(); - mapSQLfields(); -} -elsif ( $query->param("MapCOMinput") ) -{ - print $query->header(); - MapCOMinput(); -} -elsif ( $query->param("MapCOMoutput") ) +elsif ( $query->param("Confirm Page") ) { print $query->header(); - MapCOMoutput(); + Confirm_Page(); } else { print $query->header(); - welcome_form(); + webservice_properties(); } #******************************************************************************** @@ -150,34 +120,6 @@ JAVA_SCRIPT } -#*********************************************************************** -# -# This is just a Welcome page where users will learn about the program and how to interact with it -# -#*********************************************************************** -sub welcome_form -{ -print < - - MOBY-S Web Service Auto-Generator - - - - -
    -

    MOBY-S Web Service Auto-Generator Form

    -

     

    - This service (wizard) is provided by BIOMOBY and the purpose of this service is to help you generate webservices with only a few steps and as least programming as possible!. :)
    -Click on the next button to continue -
    - - -HTML_FORM - - -} - #********************************************************************** # # DISPLAYS THE FORM WHERE USER ENTERS INFORMATION ON THE SERVICE @@ -188,7 +130,7 @@ my $Central = MOBY::Client::Central->new(Registries => {mobycentral => { URL => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', URI => 'http://mobycentral.icapture.ubc.ca/MOBY/Central/'}} - ); + ); #We grab retrieve parameters passed into it if there is an error. my $error_msg = shift; @@ -262,7 +204,6 @@ $objectConsumed_html .= ">$objectConsumed_options"; } - #Build drop down list for object produced my $objectProduced_html = ""; @@ -466,51 +407,27 @@ my $form = $query->param("properties"); + my $serviceType = $query->param("serviceType"); + my $objectConsumed = $query->param("objectConsumed"); + my $objectProduced = $query->param("objectProduced"); + my $nameSpace = $query->param("nameSpace"); + my $outnameSpace = $query->param("outnameSpace"); + my $serviceName = $query->param("serviceName"); + my $authURI = $query->param("authURI"); + my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); + my $contactEmail = $query->param("contactEmail"); + my $description = $query->param("description"); + my $directory = $query->param("directory"); + my $genORcom = $query->param("genORcom"); + my $simORcollInput = $query->param("simORcollInput"); + my $simORcollOutput = $query->param("simORcollOutput"); + my $parse_html = ""; + + #CHECK WEBSERVICE PROPERTIES if ( $form eq "Webservice Properties") { - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $outnameSpace = $query->param("outnameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); - - #HTML HIDDEN INPUTS WHEN CHECKING WEBSERVICE PROPERTIES - print < - -
    - - - - - - - - - - - - - - - - - - - -HTML - -my $error_msg = ""; + my $error_msg = ""; $error_msg .= "Please select a service type
    " if ($serviceType eq 'Please select a Service Type'); $error_msg .= "Please select an object consumed
    " if ($objectConsumed eq 'Please select an Object'); $error_msg .= "Please select Generic or Complex
    " if (!$genORcom); @@ -539,6 +456,7 @@ } } + #CHECK DBCCESS PROPERTIES elsif ( $form eq "DBAccess Properties") { @@ -550,47 +468,10 @@ my $password1 = $query->param("password1"); my $password2 = $query->param("password2"); my $prefixed = $query->param("prefixed"); - - my $sqlStatement = $query->param("sqlStatement"); - - #WE ALSO NEED TO CONTINUE PASSING THE OTHER VARIABLES - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $outnameSpace = $query->param("outnameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); my $InputParam = $query->param("InputParam"); + my $sqlStatement = $query->param("sqlStatement"); - #HTML HIDDEN INPUTS WHEN CHECKING DBACCESS PROPERTIES - print < - -
    - - - - - - - - - - - - - - - - + $parse_html .= qq{ @@ -598,14 +479,9 @@ - - - - -HTML - -my $error_msg_sql = ""; + }; + my $error_msg_sql = ""; $error_msg_sql .= "Please provide a database type
    " if (!$dbType && ($sqlORalgor_rad eq 'sql')); $error_msg_sql .= "Please provide a database instance
    " if (!$dbInstance && ($sqlORalgor_rad eq 'sql')); $error_msg_sql .= "Please provide a host and port number
    " if (!$host_port && ($sqlORalgor_rad eq 'sql')); @@ -633,51 +509,10 @@ #CHECK Algorithm PROPERTIES elsif ( $form eq "Algorithm Properties") { - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); my $htmlORcom = $query->param("htmlORcom"); - my $outnameSpace = $query->param("outnameSpace"); - - - #HTML HIDDEN INPUTS WHEN CHECKING WEBSERVICE PROPERTIES - print < - -
    - - - - - - - - - - - - - - - - - - - -HTML - -my $error_msg = ""; + $parse_html .= qq{}; + my $error_msg = ""; $error_msg .= "Please select using a Command Line Algorithm or a HTML Wrapper algorithm
    " if (!$htmlORcom); if ( $error_msg ) @@ -685,69 +520,33 @@ #Returns users to original form algorithm_properties($error_msg); } - elsif ($htmlORcom eq "htmlWrapper") - { - HTMLWrapper_properties(); - } else { - CommandLine_properties(); + HTMLWrapper_properties(); } } - + #CHECK HTML Wrapper PROPERTIES elsif ( $form eq "HTML Wrapper Properties") { - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); - my $htmlORcom = $query->param("htmlORcom"); + my $htmlORcom = $query->param("htmlORcom"); my $ServiceURL = $query->param("ServiceURL"); my $InputParam = $query->param("InputParam"); - my $outnameSpace = $query->param("outnameSpace"); - - #HTML HIDDEN INPUTS WHEN CHECKING WEBSERVICE PROPERTIES - print < - -
    - - - - - - - - - - - - - - + $parse_html .= qq{ - - - - - -HTML + }; -my $error_msg = ""; + my $error_msg = ""; + + if($htmlORcom eq "htmlWrapper"){ + $error_msg .= "Please provide the Service URL
    " if (!$ServiceURL); + } + else{ + $error_msg .= "Please provide the Command Line
    " if (!$ServiceURL); + } - $error_msg .= "Please provide the Service URL
    " if (!$ServiceURL); $error_msg .= "Please Specify the number of Input parameters
    " if (!$InputParam); if ( $error_msg ) @@ -761,32 +560,19 @@ } } + + #CHECK Algorithm Input Mapping PROPERTIES elsif ( $form eq "MapHTMLinput") { - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); my $htmlORcom = $query->param("htmlORcom"); my $ServiceURL = $query->param("ServiceURL"); my $InputParam = $query->param("InputParam"); - my $outnameSpace = $query->param("outnameSpace"); + my $comline = $query->param("comline"); my $error_msg = ""; my $temp=""; my $temp2=""; - my $parse_html=""; - for(my $s=0; $s<$InputParam;$s++){ $temp = $query->param("InputParam$s"); $temp2 = $query->param("inputobject_articles$s"); @@ -797,37 +583,10 @@ $error_msg .= "Please provide the name for Parameter $s
    " if (!$temp); } - - - #HTML HIDDEN INPUTS WHEN CHECKING WEBSERVICE PROPERTIES - print < - -
    - - - - - - - - - - - - - - - + $parse_html .= qq{ - - $parse_html - - - -HTML - + }; if ( $error_msg ) { @@ -837,44 +596,37 @@ else { - MapHTMLinput2(); + if ($htmlORcom eq "htmlWrapper"){ + MapHTMLinput2(); + } + else{ + MapHTMLoutput(); + } } } elsif ( $form eq "MapHTMLinput2") { - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); - my $htmlORcom = $query->param("htmlORcom"); + my $htmlORcom = $query->param("htmlORcom"); my $ServiceURL = $query->param("ServiceURL"); my $InputParam = $query->param("InputParam"); - my $outnameSpace = $query->param("outnameSpace"); my $DV_count = $query->param("DV_count"); my $error_msg = ""; - my $temp=""; my $temp2=""; my @DValue=(); - my $parse_html=""; - + + $parse_html .= qq{ + + + }; + for(my $s=0; $s<$InputParam;$s++){ $temp = $query->param("InputParam$s"); $temp2 = $query->param("inputobject_articles$s"); $parse_html .= ""; $parse_html .= ""; - } for(my $i=1;$i <= $DV_count;$i++){ @@ -883,124 +635,90 @@ $parse_html .= ""; $error_msg .= "Please provide the name for Parameter" if (!$temp); } + + if ( $error_msg ) + { + #Returns users to original form + MapHTMLinput2(@DValue); + } + else + { + MapHTMLoutput(); + } - #HTML HIDDEN INPUTS WHEN CHECKING WEBSERVICE PROPERTIES - print < - -
    - - - - - - - - - - - - - - - - - - - - - - -HTML - + } + #CHECK SQL Input Mapping PROPERTIES + elsif ( $form eq "mapSQLinput") + { + my $dbType = $query->param("dbType"); + my $dbInstance = $query->param("dbInstance"); + my $host_port = $query->param("host_port"); + my $username = $query->param("username"); + my $password1 = $query->param("password1"); + my $password2 = $query->param("password2"); + my $prefixed = $query->param("prefixed"); + my $serviceCode = $query->param("serviceCode"); + my $InputParam = $query->param("InputParam"); + + my $temp=""; + my $temp2=""; + my $error_msg = ""; + + for(my $s=0; $s<$InputParam;$s++){ + $temp = $query->param("InputParam$s"); + $temp2 = $query->param("inputobject_articles$s"); + push(@InParam,$temp); + $parse_html .= ""; + $parse_html .= ""; + + $error_msg .= "Please provide the name for variable $s
    " if (!$temp); + } + + $parse_html .= q{ + + + + + + + + }; + if ( $error_msg ) { #Returns users to original form - MapHTMLinput2(@DValue); + mapSQLinput($error_msg,@InParam); } - else { - MapCOMoutput(); + mapSQLfields(); } - + } - elsif ( $form eq "mapSQLinput") - { - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $outnameSpace = $query->param("outnameSpace"); - my $dbType = $query->param("dbType"); - my $dbInstance = $query->param("dbInstance"); - my $host_port = $query->param("host_port"); - my $username = $query->param("username"); - my $password1 = $query->param("password1"); - my $password2 = $query->param("password2"); - my $prefixed = $query->param("prefixed"); - - #ADD IN HIDDEN INPUT TYPE IF THIS VARIABLE IS NEEDED - #my $perlModules = $query->param("perlModules"); - - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); - + #CHECK OTHER PROPERTIES my $serviceCode = $query->param("serviceCode"); - my $InputParam = $query->param("InputParam"); - - my $temp=""; - my $temp2=""; - my $parse_html=""; - my $error_msg = ""; - - for(my $s=0; $s<$InputParam;$s++){ - $temp = $query->param("InputParam$s"); - $temp2 = $query->param("inputobject_articles$s"); - push(@InParam,$temp); - $parse_html .= ""; - $parse_html .= ""; - - $error_msg .= "Please provide the name for variable $s
    " if (!$temp); - } - - + my $perlModules = $query->param("perlModules"); #HTML HIDDEN INPUTS WHEN CHECKING WEBSERVICE PROPERTIES print <
    + + - - - - - - - - - - @@ -1011,26 +729,6 @@ HTML - if ( $error_msg ) - { - #Returns users to original form - mapSQLinput($error_msg,@InParam); - } - - else - { - mapSQLfields(); - } - - } - - - #CHECK OTHER PROPERTIES - my $serviceCode = $query->param("serviceCode"); - my $perlModules = $query->param("perlModules"); - - - } @@ -1071,8 +769,9 @@ my $simORcollOutput = $query->param("simORcollOutput"); #Build drop down list box for Database types - my $dbType_html; + my $dbType_html = ""; my @dbTypes_opts = ("mysql", "oracle", "mssql", "odbc", "sybase", "informix"); + foreach my $dbTypes_option (sort(@dbTypes_opts)) { $dbType_html .= "


    - + @@ -1459,11 +1147,11 @@ #Used to display html - my $SQLmapping_html; + my $SQLmapping_html = ""; my $parse_html = ""; - my $temp; - my $temp2; + my $temp=""; + my $temp2=""; for(my $s=0; $s<$InputParam;$s++){ $temp = $query->param("InputParam$s"); @@ -1475,28 +1163,10 @@ if($sqlORalgor_rad eq "sql") { - - #***************************************************************************** - #* - #* This part is used only when the webservice is defined as an SQL service - #* - #****************************************************************************** - - #Here is the trick on getting the mapping. - #We need to get the values of parameters object_articlesX - #Since X varies it is not possible to do a multiple query search on it. So we have to put the parameter values into an array - #In order to get the values, we have to use a query->param to get it and put it into the @SQLmapping array - - #Retrieving the parameters and putting it into an array. - #This is one way of passing the mapping around - for(my $s=0; $s<$column_length;$s++){ $temp2 = $query->param("outputobject_articles$s"); - $SQLmapping_html .= $temp2; $parse_html .= ""; - } - #*************************************************************************************** } else{ @@ -1508,7 +1178,6 @@ } $temp2 = $query->param("outputobject_articles0"); $parse_html .= ""; - $error_msg = $temp2; } print < - - $SQLmapping_html $parse_html - @@ -1628,7 +1294,6 @@ print $dispatcherCode; } - #************************************************************************** # # THIS FUNCTION DISPLAYS THE CODE GENERATED, ALSO THE MAIN CODE GENERATOR @@ -1638,7 +1303,6 @@ # the rest of the code is kept in an xml called codebook.xml # #************************************************************************** - sub generate_code { @@ -1665,11 +1329,9 @@ #Perl Modules still needs to be implemented. my $perlModules = $query->param("perlModules"); - my $genORcom = $query->param("genORcom"); my $simORcollInput = $query->param("simORcollInput"); my $simORcollOutput = $query->param("simORcollOutput"); - my $htmlORcom = $query->param("htmlORcom"); my $URL = $query->param("URL"); @@ -1684,13 +1346,11 @@ } #Html Wrapper Properties - my $ServiceURL = $query->param("ServiceURL"); my $InputParam = $query->param("InputParam"); my $DV_count = $query->param("DV_count"); #Command Line Properties - my $comline = $query->param("comline"); @@ -1837,7 +1497,6 @@ } } - $packages_modules .= $code->get("useSQL"); $dbAccess_prepare = $code->get("dbAccess_prepare", (serviceCode=>$serviceCode)); @@ -1928,10 +1587,8 @@ $HTMLWrapper_main = $code->get("HTMLWrapper_main",(MobyObject=>$MobyObject,namespace=>$outnameSpace)); } - else{ - for(my $s=0; $s<$InputParam;$s++){ $temp = $InParam[$s]; $temp2 = $mapArticles[$s]; @@ -1946,7 +1603,6 @@ $DefaultValue .= $code->get("getNodeContent",(InputParam=>"\$$temp",Tag=>$Tag,Article=>$temp2)); $comline =~ s/$temp/\$$temp/g; } - } $CommandLine_main = $code->get("CommandLine_main",(comline=>$comline,reader=>'',MobyObject=>$MobyObject,namespace=>$outnameSpace )); @@ -1967,27 +1623,6 @@ - - FOR DEBUGGIN PURPOSES:
    - Here are the values you have entered:

    - Input count: $InputParam
    - Service Type: $serviceType
    - Object Consumed: $objectConsumed
    - Generic Or Complex: $genORcom
    - (Input) Simple or Collection: $simORcollInput
    - Object Produced: $objectProduced
    - (Output) Simple or Collection: $simORcollOutput
    - Prefixed: $prefixed
    - Namespace: $outnameSpace
    - Service Name: $serviceName
    - Authority URI: $authURI
    - Dispatcher URL: $URL
    - Contact Email: $contactEmail
    - Description: $description
    - SQL or Algorithm: $htmlORcom

    -

    - Code: $MobyObject -

    THE FOLLOWING IS THE PERL MODULE FOR YOUR SERVICE

    Confirm that the values above and the code below are correct, click on the 'Save Code As' button and save the perl module onto your server. Save the service as XXX.pm (where XXX is your service name). Place the file in the same folder as the dispatcher.cgi. Then click on the 'Register' button to register the service. @@ -2070,9 +1705,6 @@ } - - - #******************************************************************************** # # name: getXMLObject @@ -2178,11 +1810,9 @@ } } } - #Returns the whole XML back return ($theNode->toString); - } #This function saves the webservice code @@ -2487,8 +2117,7 @@ my $simORcollInput = $query->param("simORcollInput"); my $simORcollOutput = $query->param("simORcollOutput"); - my $serviceCode = $query->param("serviceCode"); - +javascript_functions(); #Print the HTML form out print < @@ -2506,10 +2135,8 @@ Once you have finished filling in the form click on the 'Next' button to continue.

    $error_msg

    Please fill in the required fields

    -
    - @@ -2539,10 +2166,8 @@ HTML_FORM - } - #*************************************************************************** # # THIS FUNCTION DISPLAYS THE ALGORITHM PROPERTIES @@ -2575,17 +2200,30 @@ my $outnameSpace = $query->param("outnameSpace"); my $serviceCode = $query->param("serviceCode"); + my $service_html =""; + my $service_html2 =""; + + #For the HTML Wrapper, the program will ask user to provide the location of their Service URL + #For the Command Line, the program will ask user to provide the command with the variable names in order to execute the program + if ($htmlORcom eq "htmlWrapper"){ + $service_html = "Service URL :"; + } + else{ + $service_html = "Command Line:"; + $service_html2 = "
    Note: Please provide a name (eg. var1) for each of the mapping variable in the Command"; + } + #Print the HTML form out print < - MOBY-S Web Service Auto-Generator - HTML Wrapper Properties + MOBY-S Web Service Auto-Generator - Command Line / HTML Wrapper Properties
    -

    HTML Wrapper Properties

    +

    Command Line / HTML Wrapper Properties

     

    Since you have selected an HTML Wrapper Algorithm. Please provide the following information:.
    @@ -2595,7 +2233,6 @@ - @@ -2611,10 +2248,9 @@ - - + @@ -2626,15 +2262,14 @@
    Service URL: $service_html http://[?]
    Number of Input Parameters:
    + $service_html2 HTML_FORM - } - #*********************************************************************************************************** # # HTML WRAPPER INPUT MAPPING FUNCTION @@ -2649,8 +2284,7 @@ { my $error_msg = shift; my @InParam = shift; - - + #WE ALSO NEED TO CONTINUE PASSING THE OTHER VARIABLES my $serviceType = $query->param("serviceType"); my $objectConsumed = $query->param("objectConsumed"); @@ -2670,14 +2304,10 @@ my $InputParam = $query->param("InputParam"); my $outnameSpace = $query->param("outnameSpace"); my $serviceCode = $query->param("serviceCode"); + my $comline = $ServiceURL; - # check the Service URL prefix, if it isn't prefixed With (http://) , then prefix it for the purposes of the html call - unless ($ServiceURL =~/^http:\/\//){ - $ServiceURL = "http://$ServiceURL"; - } #Displaying the different input text boxes for user to type the names of parameters - #Displaying the different input text boxes for user to type the names of parameters my @object_articles_opts = mygetArticles($objectConsumed); my $articles_length = @object_articles_opts; @@ -2703,18 +2333,33 @@ "; } - + + my $service_html =""; + if ($htmlORcom eq "htmlWrapper"){ + # check the Service URL prefix, if it isn't prefixed With (http://) , then prefix it for the purposes of the html call + unless ($ServiceURL =~/^http:\/\//){ + $ServiceURL = "http://$ServiceURL"; + } + + $service_html = qq{

    Service URL: $ServiceURL

    }; + } + + else{ + $service_html = qq{

    Command Line: $comline

    }; + } + + #Print the HTML form out print < - MOBY-S Web Service Auto-Generator - HTML Input Mapping + MOBY-S Web Service Auto-Generator - HTML/Command Line Input Mapping
    -

    HTML Input Mapping

    +

    HTML/Command Line Input Mapping

     

    Please specify the names of the input Parameters:.
    Once you have finished filling in the form click on the 'Next' button to continue. @@ -2738,8 +2383,9 @@ +
    You have entered: -

    Service URL: $ServiceURL

    + $service_html

    Please fill in the required fields

    @@ -2764,8 +2410,6 @@ } - - #*********************************************************************************************************** # # HTML WRAPPER INPUT INITIALIZATION @@ -2801,10 +2445,9 @@ my $temp=""; my $temp2=""; my $DV_count = 0; - my $parse_html=""; -#Display the mapping values from the previous function and Ask for the Default value of the "other" type paramaters from user + #Display the mapping values from the previous function and Ask for the Default value of the "other" type paramaters from user for(my $s=0; $s<$InputParam;$s++){ $temp = $query->param("InputParam$s"); $temp2 = $query->param("inputobject_articles$s"); @@ -2958,8 +2601,6 @@ } } } - - } #*********************************************************************************************************** # @@ -2971,7 +2612,6 @@ # The user will have to associate "X" with "Term" and "Y" with "Definition" # #************************************************************************************************************ - sub mapSQLinput{ my $error_msg = shift; @@ -2995,14 +2635,9 @@ my $password1 = $query->param("password1"); my $password2 = $query->param("password2"); my $prefixed = $query->param("prefixed"); - - #ADD IN HIDDEN INPUT TYPE IF THIS VARIABLE IS NEEDED - #my $perlModules = $query->param("perlModules"); - my $genORcom = $query->param("genORcom"); my $simORcollInput = $query->param("simORcollInput"); my $simORcollOutput = $query->param("simORcollOutput"); - my $serviceCode = $query->param("sqlStatement"); my $InputParam = $query->param("InputParam"); @@ -3026,7 +2661,7 @@ $object_articles_html .= ""; $articles_length += 1; - my $InputParam_html = $objectConsumed; + my $InputParam_html = ""; for(my $i=0; $i<$InputParam;$i++){ $InputParam_html .= " @@ -3095,7 +2730,6 @@ MAP - } #****************************************************************************** @@ -3117,245 +2751,56 @@ return @list; } -sub CommandLine_properties -{ - - my $error_msg = shift; - my $comline = shift; - my $InputParam = shift; +#*********************************************************************************************************** +# +# HTML WRAPPER OUTPUT MAPPING FUNCTION +# - description: THIS FUNCTION asks users to map the output to an Object Articles +# eg. MobyObject: GO_Term, GO has String called Term AND has string called Definition +# The user can map the output to one of the "Term", "Definition", or "id" +# +#************************************************************************************************************ +sub MapHTMLoutput{ - #WE ALSO NEED TO CONTINUE PASSING THE OTHER VARIABLES my $serviceType = $query->param("serviceType"); my $objectConsumed = $query->param("objectConsumed"); my $objectProduced = $query->param("objectProduced"); my $nameSpace = $query->param("nameSpace"); + my $outnameSpace = $query->param("outnameSpace"); my $serviceName = $query->param("serviceName"); my $authURI = $query->param("authURI"); my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); my $contactEmail = $query->param("contactEmail"); my $description = $query->param("description"); my $directory = $query->param("directory"); + + #ADD IN HIDDEN INPUT TYPE IF THIS VARIABLE IS NEEDED + #my $perlModules = $query->param("perlModules"); + my $genORcom = $query->param("genORcom"); my $simORcollInput = $query->param("simORcollInput"); my $simORcollOutput = $query->param("simORcollOutput"); + my $InputParam = $query->param("InputParam"); my $htmlORcom = $query->param("htmlORcom"); - my $outnameSpace = $query->param("outnameSpace"); - my $serviceCode = $query->param("serviceCode"); + my $comline = $query->param("comline"); - #Print the HTML form out - print < - - MOBY-S Web Service Auto-Generator - Command Line Properties - - + my $parse_html = ""; + my $temp; + my $temp2; + + #keep on passing the inout parameters to then next page + for(my $s=0; $s<$InputParam;$s++){ + $temp = $query->param("InputParam$s"); + $temp2 = $query->param("inputobject_articles$s"); + $parse_html .= ""; + $parse_html .= ""; + + } - -
    -

    Command Line Properties

    -

     

    - - Since you have selected a Command Line Algorithm. Please provide the following information:.
    - Once you have finished filling in the form click on the 'Next' button to continue. -

    $error_msg

    -

    Please fill in the required fields

    + #addition data passing (Default Values) for the html wrapper + if($htmlORcom eq "htmlWrapper"){ -
    - - - - - - - - - - - - - - - - - - -
    Parameters $i:
    - - - - - - -
    -
    Command Line: [?]
    Number of Input Parameters: [?]
    - - - - -
    -
    Note: Please provide a name (eg. var1) for each of the mapping variable in the Command -
    - - - - -HTML_FORM - - -} - -sub MapCOMinput -{ - my $error_msg = shift; - my @InParam = shift; - - #WE ALSO NEED TO CONTINUE PASSING THE OTHER VARIABLES - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); - my $htmlORcom = $query->param("htmlORcom"); - my $InputParam = $query->param("InputParam"); - my $outnameSpace = $query->param("outnameSpace"); - my $comline = $query->param("comline"); - - #Displaying the different input text boxes for user to type the names of parameters - - my @object_articles_opts = mygetArticles($objectConsumed); - my $articles_length = @object_articles_opts; - - #Displaying the All the field, id and article names, in a selection box in the right column of the table for mapping purpose - my $object_articles_html; - foreach my $object_article_option (@object_articles_opts) - { - $object_articles_html .= ""; - # If some of the Parameters need Initial/Default Values, eg: number of result per page, select the "other" value - - $object_articles_html .= ""; - $articles_length += 2; - - my $InputParam_html = ""; - for(my $i=0; $i<$InputParam;$i++){ - $InputParam_html .= " Parameters $i: - - -"; - } - - #Print the HTML form out - print < - - MOBY-S Web Service Auto-Generator - Command Line Input Mapping - - - - -
    -

    Command Line Input Mapping

    -

     

    - Please specify the names of the input Parameters:.
    - Once you have finished filling in the form click on the 'Next' button to continue. -

    $error_msg

    -
    - - - - - - - - - - - - - - - - - - -
    You have entered: -

    Command Line: $comline

    -

    Please fill in the required fields

    - - - - - - - $InputParam_html -
    - -
    Input Variable Name
    Moby Object Article
    - - - - -
    -
    - - - -HTML_FORM - -} - -sub MapCOMoutput{ - - my $serviceType = $query->param("serviceType"); - my $objectConsumed = $query->param("objectConsumed"); - my $objectProduced = $query->param("objectProduced"); - my $nameSpace = $query->param("nameSpace"); - my $outnameSpace = $query->param("outnameSpace"); - my $serviceName = $query->param("serviceName"); - my $authURI = $query->param("authURI"); - my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); - my $contactEmail = $query->param("contactEmail"); - my $description = $query->param("description"); - my $directory = $query->param("directory"); - - #ADD IN HIDDEN INPUT TYPE IF THIS VARIABLE IS NEEDED - #my $perlModules = $query->param("perlModules"); - - my $genORcom = $query->param("genORcom"); - my $simORcollInput = $query->param("simORcollInput"); - my $simORcollOutput = $query->param("simORcollOutput"); - my $InputParam = $query->param("InputParam"); - my $htmlORcom = $query->param("htmlORcom"); - my $comline = $query->param("comline"); - - my $parse_html = ""; - - my $temp; - my $temp2; - - for(my $s=0; $s<$InputParam;$s++){ - $temp = $query->param("InputParam$s"); - $temp2 = $query->param("inputobject_articles$s"); - $parse_html .= ""; - $parse_html .= ""; - - } - - if($htmlORcom eq "htmlWrapper"){ - - my $ServiceURL = $query->param("ServiceURL"); - my $DV_count = $query->param("DV_count"); + my $ServiceURL = $query->param("ServiceURL"); + my $DV_count = $query->param("DV_count"); $parse_html .= qq{ }; $parse_html .= qq{}; @@ -3433,10 +2878,230 @@

    - + MAP } + +#*********************************************************************************************************** +# +# Confirm Page: List all the data entered by users +# - description: THIS FUNCTION allows users to have a look on the data they have entered before +# the code generation +#************************************************************************************************************ +sub Confirm_Page{ + + #Get the parameters to validate the form + my $serviceType = $query->param("serviceType"); + my $objectConsumed = $query->param("objectConsumed"); + my $objectProduced = $query->param("objectProduced"); + my $nameSpace = $query->param("nameSpace"); + my $serviceName = $query->param("serviceName"); + my $authURI = $query->param("authURI"); + my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); + my $serviceCode = $query->param("serviceCode"); + my $URL = $query->param("URL"); + my $contactEmail = $query->param("contactEmail"); + my $description = $query->param("description"); + my $directory = $query->param("directory"); + my $outnameSpace = $query->param("outnameSpace"); + + #DataBase Properties + my $dbType = $query->param("dbType"); + my $dbInstance = $query->param("dbInstance"); + my $host_port = $query->param("host_port"); + my $username = $query->param("username"); + my $password1 = $query->param("password1"); + my $password2 = $query->param("password2"); + my $prefixed = $query->param("prefixed"); + my $perlModules = $query->param("perlModules"); + my $genORcom = $query->param("genORcom"); + my $simORcollInput = $query->param("simORcollInput"); + my $simORcollOutput = $query->param("simORcollOutput"); + my $column_length = $query->param("column_length"); + + #Html Wrapper Properties + my $htmlORcom = $query->param("htmlORcom"); + my $ServiceURL = $query->param("ServiceURL"); + my $InputParam = $query->param("InputParam"); + my $DV_count = $query->param("DV_count"); + + #Command Ling Properties + my $comline = $query->param("comline"); + + #Used to display html + my $Outmapping_html = "

    This option is not availabe for your service.

    "; + my $DV_html = "

    This option is not availabe for your service.

    "; + my $parse_html = ""; + my $service_html =""; + + my $temp=""; + my $temp2=""; + my @DV_list=(); + + #Print out all the Input Parameters with the associated MOBY Articles + my $input_html= " + "; + + for(my $s=0; $s<$InputParam;$s++){ + $temp = $query->param("InputParam$s"); + $temp2 = $query->param("inputobject_articles$s"); + $parse_html .= ""; + $parse_html .= ""; + + if ($temp2 eq "other"){ + push(@DV_list,$temp); + } + $input_html .= " + "; + + } + + #print out the SQL properties + if($sqlORalgor_rad eq "sql") + { + + $service_html = qq{
    Number of Input Parameters :$InputParam
    Input Parameters $temp:$temp2
    + + + + + + + +
    DataBase Type:$dbType
    DataBase Instance:$dbInstance
    Host Port:$host_port
    UserName:$username
    Password 1:$password1
    Passowrd 2:$password2
    Namespace Prefixed:$prefixed
    SQL Query:$serviceCode
    }; + + #Print out all the Output Columns with the associated MOBY Articles + $Outmapping_html = " + "; + + for(my $s=0; $s<$column_length;$s++){ + $temp2 = $query->param("outputobject_articles$s"); + $Outmapping_html .= " + "; + $parse_html .= ""; + + } + } + + #Print out the Algorithm properties + else{ + + #print out the HTMLWrapper Properties + if($htmlORcom eq "htmlWrapper"){ + + $service_html = qq{
    Number of output Column :$column_length
    Output Column :$temp2
    Service URL:$ServiceURL
    }; + $DV_html = " + "; + + #print out the Default Values + for(my $i=1;$i <= $DV_count;$i++){ + + my $s =$i-1; + $temp2 = $query->param("DValue$i"); + $parse_html .= ""; + + $temp = $DV_list[$s]; + $DV_html .= " + "; + } + } + + else{ + $service_html = qq{
    Number of Default Input :$DV_count
    $temp :$temp2
    Command Line:$comline
    }; + } + $temp2 = $query->param("outputobject_articles0"); + $parse_html .= ""; + $Outmapping_html = " + "; + } + + print < + + MOBY-S Web Service Auto-Generator - Data Confirmation + + + +
    +

    Data Confirmation +

    +

    +

     

    + The following are the values you have entered from the previous steps. If the data is correct, please click "next".
    + If the data is incorrect, please go back the make the change
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + $parse_html + + + + + + + +
    +

    General Web Services Data

    +

    +

    Output Article :$temp2
    + + + + + + + + + + + +
    Service Name:$serviceName
    Service Type:$serviceType
    Object Consumed:$objectConsumed
    Input Namespace:$nameSpace
    Simple or Collection (Input):$simORcollInput
    Object Produced:$objectConsumed
    Output Namespace:$outnameSpace
    Simple or Collection (Output):$simORcollOutput
    Authority URI:$authURI
    Contact Email:$contactEmail
    Service Description:$description
    SQL or Algorithm:$htmlORcom
    +

    + +

    Algorithm / SQL Properties

    + $service_html +

    + +

    Input Parameter

    + $input_html +

    + +

    Output Mapping

    + $Outmapping_html + +

    HTML Wrapper Default Value

    + $DV_html +

    + + + + +MAP + +} From gordonp at pub.open-bio.org Mon Aug 15 13:41:41 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Mon Aug 15 14:27:11 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508151741.j7FHffUp006469@pub.open-bio.org> gordonp Mon Aug 15 13:41:41 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory pub.open-bio.org:/tmp/cvs-serv6436/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java MobyDataInstance.java MobyDataSecondaryInstance.java Log Message: Forgot to add these last time, to make all underlying Java data objects accessible in org.biomoby.shared.data moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.3,1.4 MobyDataInstance.java,1.1,1.2 MobyDataSecondaryInstance.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2005/07/22 05:11:54 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2005/08/15 17:41:41 1.4 @@ -146,7 +146,14 @@ return instanceXML.toString(); } } - + + /** + * @return HashMap of member names to MobyDataObjects + */ + public Object getObject(){ + return members; + } + // Below, to the end of the class file, are the methods that must be // implemented to satisfy the ConcurrentMap interface =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInstance.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInstance.java 2005/05/12 04:59:49 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInstance.java 2005/08/15 17:41:41 1.2 @@ -30,4 +30,10 @@ */ public int getXmlMode(); + /** + * Each implementer will return the underlying Java object used to store the MOBY value. + * For example, MOBY Floats are stored internally as BigDecimal objects. + */ + public Object getObject(); + } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2005/07/22 05:11:54 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2005/08/15 17:41:41 1.4 @@ -66,6 +66,13 @@ setValue(MobyDataObject.getTextContents((Element) values.item(0))); } + /** + * For now, all secondary parameters are treated as strings. + */ + public Object getObject(){ + return getValue(); + } + public void setValue(String value) throws IllegalArgumentException{ dataValue = value; } From mwilkinson at pub.open-bio.org Wed Aug 17 13:58:13 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 17 14:56:10 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508171758.j7HHwDhB013584@pub.open-bio.org> mwilkinson Wed Aug 17 13:58:13 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv13547/MOBY/Client Modified Files: Central.pm Log Message: adding restrictions to serviceName to be valid method calls. Added tests to ensure this is obeyed moby-live/Perl/MOBY/Client Central.pm,1.112,1.113 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.112 retrieving revision 1.113 diff -u -r1.112 -r1.113 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2005/08/03 12:00:32 1.112 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2005/08/17 17:58:13 1.113 @@ -809,7 +809,7 @@ } } if ( $ch == 0 ) { - print "call Agent\n"; + # print "call Agent\n"; my $message = " From mwilkinson at pub.open-bio.org Wed Aug 17 13:58:13 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 17 14:56:48 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508171758.j7HHwDrI013566@pub.open-bio.org> mwilkinson Wed Aug 17 13:58:13 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv13547/MOBY Modified Files: Central.pm Log Message: adding restrictions to serviceName to be valid method calls. Added tests to ensure this is obeyed moby-live/Perl/MOBY Central.pm,1.201,1.202 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.201 retrieving revision 1.202 diff -u -r1.201 -r1.202 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/04 09:05:38 1.201 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/17 17:58:13 1.202 @@ -1205,8 +1205,7 @@ my $conf = MOBY::Config->new(); my $path = $conf->{mobycentral}->{rdfagent}; my $rez = system( $path. " " . $signatureURL ); - return &_success( -"The RDFagent call was successful. Report will send to you by E-mail", + return &_success( "The RDFagent call was successful. Report will send to you by E-mail", "" ) if ( $rez == 0 ); @@ -1221,7 +1220,9 @@ my $error; $error .= "missing serviceName \n" unless defined $serviceName; $error .= "missing serviceType \n" unless defined $serviceType; - + $error .= "invalid character string for serviceName. Must start with a letter followed by [A-Za-z0-9_]\n" if ($serviceName =~ /[^A-Za-z]/); + $error .= "invalid character string for serviceName. Must start with a letter followed by [A-Za-z0-9_]\n" if ($serviceName =~ /.[^A-Za-z0-9_]/); + # $error .="missing signatureURL \n" unless defined $signatureURL; $error .= "missing authURI \n" unless defined $AuthURI; $error .= "missing contactEmail \n" unless defined $contactEmail; From mwilkinson at pub.open-bio.org Wed Aug 17 13:58:13 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 17 14:56:52 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508171758.j7HHwDgl013604@pub.open-bio.org> mwilkinson Wed Aug 17 13:58:13 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv13547/t Modified Files: Client-Central.t Log Message: adding restrictions to serviceName to be valid method calls. Added tests to ensure this is obeyed moby-live/Perl/t Client-Central.t,1.28,1.29 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/04 09:05:38 1.28 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/17 17:58:13 1.29 @@ -150,8 +150,59 @@ is(shift(@{$rel{'urn:lsid:biomoby.org:servicerelation:isa'}}), "Retrieval") or diag("Relationships arrayref didn't return the right parentage for service types."); +# test for invalid serviceName +$r = $C->registerService( + serviceName => "1myfirstservice", + serviceType => "Retrieval", + authURI => "test.suite.com", + contactEmail => 'your@mail.address', + description => "this is my first service", + category => "moby", + URL => "http://illuminae/cgi-bin/service.pl", + input =>[ + ['articleName1', [Object => ['RubbishNamespace']]], # Simple + ], + output =>[ + ['articleName2', [String => ['RubbishNamespace']]], # Simple + ], + secondary => { + parametername1 => { + datatype => 'Integer', + default => 0, + max => 10, + min => -10, + enum => [-10, 10, 0]}}); + +( ok(!$r->success,"Service registration correctly failed with number as first character in serviceName") +) or diag("Service registration shuld have failed with numberical first character in servieName: ".$r->message) ; + +# test for invalid serviceName +$r = $C->registerService( + serviceName => "myf]irstservice", + serviceType => "Retrieval", + authURI => "test.suite.com", + contactEmail => 'your@mail.address', + description => "this is my first service", + category => "moby", + URL => "http://illuminae/cgi-bin/service.pl", + input =>[ + ['articleName1', [Object => ['RubbishNamespace']]], # Simple + ], + output =>[ + ['articleName2', [String => ['RubbishNamespace']]], # Simple + ], + secondary => { + parametername1 => { + datatype => 'Integer', + default => 0, + max => 10, + min => -10, + enum => [-10, 10, 0]}}); + +( ok(!$r->success,"Service registration correctly failed with ']' as character in serviceName") +) or diag("Service registration shuld have failed with invalid character in serviceName: ".$r->message) ; + -# Test 9 # should fail due to datatype all caps $r = $C->registerService( serviceName => "myfirstservice", serviceType => "Retrieval", From mwilkinson at pub.open-bio.org Wed Aug 17 13:59:24 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 17 14:56:55 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508171759.j7HHxOFC013676@pub.open-bio.org> mwilkinson Wed Aug 17 13:59:24 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv13657/t Modified Files: Client-Central.t Log Message: updating nubmer of tests in test suite to 127 moby-live/Perl/t Client-Central.t,1.29,1.30 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/17 17:58:13 1.29 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/17 17:59:24 1.30 @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; #use SOAP::Lite +trace; -use Test::More tests => 125; # perldoc Test::More for details +use Test::More tests => 127; # perldoc Test::More for details # Test 1 BEGIN { use_ok('MOBY::Client::Central') }; From mwilkinson at pub.open-bio.org Wed Aug 17 15:30:19 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 17 16:15:26 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508171930.j7HJUIbY013903@pub.open-bio.org> mwilkinson Wed Aug 17 15:30:18 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv13880/MOBY Modified Files: Central.pm OntologyServer.pm Log Message: this code attempts to traverse a newly created object to ensure that no articleNames appear at the same level of XML in the final object. It is curently untested so caveat emptor moby-live/Perl/MOBY Central.pm,1.202,1.203 OntologyServer.pm,1.72,1.73 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.202 retrieving revision 1.203 diff -u -r1.202 -r1.203 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/17 17:58:13 1.202 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/17 19:30:18 1.203 @@ -273,8 +273,7 @@ unless ( defined $term && defined $desc && defined $auth && defined $email ) { if ( $term =~ /FAILED/ ) { return &_error( "Malformed XML;", "" ); } - return &_error( -"Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail", + return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail", "" ); } @@ -282,13 +281,11 @@ if $auth =~ '[/:]'; return &_error( "Malformed authURI - must take the form NNN.NNN.NNN", "" ) unless $auth =~ /\./; - return &_error( -"Malformed email - must be a valid email address of the form name\@organization.foo", + return &_error("Malformed email - must be a valid email address of the form name\@organization.foo", "" ) unless $email =~ /\S\@\S+\.\S+/; - return &_error( -"Object name may not contain spaces or other characters invalid in a URN", + return &_error("Object name may not contain spaces or other characters invalid in a URN", "" ) if $term =~ /\s\"\&\<\>\[\]\^\`\{\|\}\~/; @@ -367,6 +364,7 @@ ); ($success == 0) && return &_error( $message, $URI ); my @failures; + my $messages = ""; if ( keys %{$relationships} ) { while ( my ( $reltype, $obj ) = each %{$relationships} ) { foreach ( @{$obj} ) { @@ -380,7 +378,10 @@ authority => $auth, contact_email => $email ); - ($success == 0) && push @failures, $objectType; + unless ($success){ + push @failures, $objectType; + $messages .= $message."; "; + } } } } @@ -393,8 +394,7 @@ and subsequently failed deletion. This is a critical error, and may indicate corruption of the MOBY Central registry.", $deleteURI ); - return &_error( -"object failed to register due to unexplained failure during registration of ISA/HASA relationships" + return &_error("object failed to register due to failure during registration of ISA/HASA relationships. Message returned was $messages" . ( join ",", (@failures) ) . "\n", "" ); @@ -2927,10 +2927,12 @@ if ( keys %reltypes ) { next unless $reltypes{ $rellsid}; # next unless it is one ofthe relationship types we requested } - my $lsids = $rels{$rellsid}; - next unless $lsids->[0]; + next unless $rels{$rellsid}; + my @lsids_articles = @{$rels{$rellsid}}; + next unless scalar @lsids_articles; $response .= "\n"; - foreach my $lsid ( @{$lsids} ) { + foreach my $lsid_article ( @lsids_articles ) { + my ($lsid, $articleName) = @$lsid_article; # ugh... I have to cheat here because the term is not returned from the Ontology Server # one day we may have to fix this... $lsid =~ /urn\:lsid\:[^\:]+\:[^\:]+\:([^\:]+)/; # get the term portion of the LSID =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/02 15:18:00 1.72 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/17 19:30:18 1.73 @@ -457,7 +457,6 @@ return ( 0, "WRONG ONTOLOGY!", '' ) unless ( $self->ontology eq 'object' ); -# my ( $subj_id, $subj_lsid, $obj_id, $obj_lsid ); my $result = $adaptor->query_object(type => $args{subject_node}); my $row = shift(@$result); my $subj_lsid = $row->{object_lsid}; @@ -480,16 +479,23 @@ } my $OE = MOBY::OntologyServer->new( ontology => 'relationship' ); my ( $success, $desc, $rel_lsid ) = $OE->relationshipExists( - term => $args{relationship}, - ontology => 'object' ); - ($success) - || return ( 0, + term => $args{relationship}, + ontology => 'object' ); + ($success) || return ( 0, qq{Relationship $args{relationship} does not exist in the ontology}, '' ); + + unless ($rel_lsid =~ /urn\:lsid\:biomoby\.org\:objectrelation\:isa/){ + my $articleNameInvalid = &_testIdenticalArticleName(term => $subj_lsid, articleName => $args{articleName}); + return (0, "Object will have conflicting articleName", '') if $articleNameInvalid; + } + my $insertid = $adaptor->insert_object_term2term(relationship_type => $rel_lsid, object1_type => $subj_lsid, object2_type => $obj_lsid, object2_articlename => $args{articleName}); + + if ($insertid ) { return ( 1, "Object relationsihp created successfully", '' ); } else { @@ -498,6 +504,54 @@ } } +sub _testIdenticalArticleName { + my (%args)= @_; + my $term = $args{term}; + my $articleName = $args{articleName}; + my $foundCommonArticleNameFlag = 0; + # need to first traverse down the ISA pathway to root + # then for each ISA test the hAS and HASA's for their articlenames and see if they are the same + # case insensitive? + my $OS = MOBY::OntologyServer->new(ontology => 'relationship'); + my $relationships = $OS->Relationships( + ontology => 'object', + term => $args{term}, + relationship => 'isa', + direction => 'root', + expand => 1); + #relationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] + my ($isa) = keys(%$relationships); # can only be one key returned, and must be isa in this case + my @ISAlist = @{$relationships->{$isa}}; + foreach my $ISA(@ISAlist){ # $ISA = [lsid, articleName] (but articleName shuld be null anyway in this case) + my $what_it_is = shift @$ISA; + my $hasarelationships = $OS->Relationships( + ontology => 'object', + term => $what_it_is, + relationship => 'hasa', + direction => 'root', + ); + #$hasarelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] + my ($hasa) = keys(%$hasarelationships); + my @HASAlist = @{$hasarelationships->{$hasa}}; + foreach my $HASA(@HASAlist){ + $foundCommonArticleNameFlag = 1 if ($HASA->[1] eq $articleName); + } + my $hasrelationships = $OS->Relationships( + ontology => 'object', + term => $what_it_is, + relationship => 'has', + direction => 'root', + ); + #$hasrelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] + my ($has) = keys(%$hasrelationships); + my @HASlist = @{$hasrelationships->{$hasa}}; + foreach my $HAS(@HASlist){ + $foundCommonArticleNameFlag = 1 if ($HAS->[1] eq $articleName); + } + } + return $foundCommonArticleNameFlag; +} + =head2 addServiceRelationship =cut @@ -1065,18 +1119,21 @@ return {[]} unless $defs; # somethig has gone terribly wrong! my $lsid; my $rel; + my $articleName; foreach ( @{$defs} ) { $lsid = $_->[0]; $rel = $_->[1]; + $articleName = $_->[2]; + $articleName ||=""; $debug && _LOG("\t\tADDING RELATIONSHIP $_ : $lsid to $rel\n"); - push @{ $results{$rel} }, $lsid; + push @{ $results{$rel} }, [$lsid, $articleName]; } 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; #results(relationship} = [lsid1, lsid2, lsid3] + return \%results; #results(relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] } sub _doRelationshipsQuery { @@ -1157,9 +1214,9 @@ if ( $IDS{$termthingy} eq "tested" ) ; # if it has been tested already then move on my $lsids = $self->Relationships( - term => $termthingy, - relationship => $relationship, - direction => $direction + term => $termthingy, + relationship => $relationship, + direction => $direction ) ; # get the related terms for this type; this should return a single hash value if ( $IDS{$termthingy} =~ /root/ ) @@ -1173,8 +1230,9 @@ } #${$lsids}{relationshiptype}=[lsid, lsid, lsid]; - foreach my $lsid ( @{ $lsids->{$relationship} } ) + foreach my $lsid_article ( @{ $lsids->{$relationship} } ) { # go through the related terms + my ($lsid, $article) = @{$lsid_article}; $debug && _LOG("found $lsid as relationship"); next if ( defined $IDS{$lsid} ) From mwilkinson at pub.open-bio.org Wed Aug 17 15:30:19 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 17 16:15:29 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508171930.j7HJUJ2A013922@pub.open-bio.org> mwilkinson Wed Aug 17 15:30:19 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory pub.open-bio.org:/tmp/cvs-serv13880/MOBY/Adaptor/moby/queryapi Modified Files: mysql.pm Log Message: this code attempts to traverse a newly created object to ensure that no articleNames appear at the same level of XML in the final object. It is curently untested so caveat emptor moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.69,1.70 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/07/29 19:33:41 1.69 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/08/17 19:30:18 1.70 @@ -1322,6 +1322,11 @@ my $ontology = $args{'ontology'}; my $relationship = $args{'relationship'}; + if ($relationship){ # need it as an lsid + my $result = $self->query_relationship(type => $relationship, ontology => $ontology); + my $row = shift @$result; + $relationship = $row->{relationship_lsid}; + } my $type = $args{'term'}; return 0 unless $type; my $lsid; @@ -1335,11 +1340,13 @@ $lsid = $row->{object_lsid}; } my $defs; - + my $extra_columns; + $extra_columns = ", relationship_type "; + if ($ontology eq "object"){$extra_columns .=", object2_articlename ";} if ( $direction eq 'root' ) { unless ( defined $relationship ) { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid, relationship_type from + select distinct s2.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 @@ -1349,7 +1356,7 @@ s1.${ontology}_lsid = ?", undef, $lsid ); # ") } else { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid, relationship_type from + select distinct s2.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 @@ -1362,7 +1369,7 @@ } else { unless ( defined $relationship ) { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid, relationship_type from + select distinct s2.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 @@ -1372,7 +1379,7 @@ s2.${ontology}_lsid = ?", undef, $lsid); # ") } else { $defs = $self->dbh->selectall_arrayref( " - select distinct s2.${ontology}_lsid, relationship_type from + select distinct s2.${ontology}_lsid $extra_columns from ${ontology}_term2term as t2t, $ontology as s1, $ontology as s2 From gordonp at pub.open-bio.org Fri Aug 19 21:58:13 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Fri Aug 19 22:42:40 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200158.j7K1wDpJ027435@pub.open-bio.org> gordonp Fri Aug 19 21:58:13 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv27410/docs Modified Files: ChangeLog Log Message: Updates to deal with requirements for named parameters in MOBY API 0.86, and some relaxing of this rule to allow existing anonymously parameterized one-input services to still be valid moby-live/Java/docs ChangeLog,1.34,1.35 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/07 23:46:11 1.34 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/20 01:58:13 1.35 @@ -1,3 +1,10 @@ +2005-08-18 Paul Gordon + + * Completed updated version of MobyRequest that deals with named parameters, + and single anonymous parameters According to MOBY API 0.86, all parameters should be named, + but this invalidates many services, so we relax the rules to allow anonymous + parameters if they are unambiguous (i.e., only one of them). + 2005-08-07 Paul Gordon * Added asynchronous mode to MobyRequest, so clients get callbacks when From gordonp at pub.open-bio.org Fri Aug 19 21:58:13 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Fri Aug 19 22:42:46 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200158.j7K1wD5J027490@pub.open-bio.org> gordonp Fri Aug 19 21:58:13 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory pub.open-bio.org:/tmp/cvs-serv27410/src/main/org/biomoby/shared/data Modified Files: MobyContentInstance.java MobyDataObject.java MobyDataObjectSet.java MobyDataSecondaryInstance.java MobyDataUtils.java Log Message: Updates to deal with requirements for named parameters in MOBY API 0.86, and some relaxing of this rule to allow existing anonymously parameterized one-input services to still be valid moby-live/Java/src/main/org/biomoby/shared/data MobyContentInstance.java,1.1,1.2 MobyDataObject.java,1.6,1.7 MobyDataObjectSet.java,1.3,1.4 MobyDataSecondaryInstance.java,1.4,1.5 MobyDataUtils.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2005/07/22 05:11:54 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2005/08/20 01:58:13 1.2 @@ -46,9 +46,11 @@ /** * A convenience constructor when you want to create an envelope with just one object in it. - * This object will be put into its own data group (mobyData tag), and automatically assigned an - * articleName if paramName is null or an empty string. - *MobyDataObjectSet + * This object will be put into its own data group (mobyData tag), and automatically assigned a + * queryID. If paramName is null, the parameter is assigned an empty string for articleName. + * For now, single parameter requests can have empty articleNames in jMOBY. This may change + * in the future. + * * @throws MobyException if the passed in object is not a MobyDataObject or a MobyDataObjectSet or null (an empty data group) */ public MobyContentInstance(MobyDataInstance mdi, String paramName) throws MobyException{ @@ -59,19 +61,21 @@ throw new MobyException("The input Moby data instance class (" + mdi.getClass().getName() + ") was neither MobyDataObject nor MobyDataObjectSet as required"); } - Vector dataGroup = new Vector(); + HashMap queryParams = new HashMap(); if(mdi != null){ - dataGroup.add(mdi); + if(paramName == null){ + paramName = ""; // Cannot have a null key in a hash + } + queryParams.put(paramName, mdi); } - put(((paramName == null || paramName.length() == 0) ? ""+autoID++ : paramName), - dataGroup); + put(""+autoID++, queryParams); } /** * Builds a MobyContentInstance (i.e. one or more MOBY queries or responses) using * a DOM-parsed XML MOBY envelope (i.e. the mobyContent tag). This is useful if you * want to parse a response from a server, or if you are a server and you want to parse - * an incoming query. The resulting object can be modifed using the standard Map + * an incoming query. The resulting object can be modified using the standard Map * interface methods, with queryID as key, and MobyDataInstance Vectors (mobyData) as values. */ public MobyContentInstance(Element objectTag) throws MobyException{ @@ -92,13 +96,13 @@ // If we got this far, we're in the clear for the single envelope // What we need to parse now is the one or more sets of data in the envelope - NodeList mobyData = objectTag.getElementsByTagNameNS(MobyPrefixResolver.MOBY_XML_NAMESPACE, - INVOCABLE_ELEMENT); + NodeList mobyData = MobyPrefixResolver.getChildElements(objectTag, + INVOCABLE_ELEMENT); if(mobyData.getLength() == 0){ throw new MobyException("The document's " + ELEMENT_NAME + "element does not have a " + INVOCABLE_ELEMENT + - " child. It must have one or more"); + " child. It must have one or more according to the MOBY API"); } // Now back to the main data @@ -125,12 +129,12 @@ // Concatenate all serviceNotes. Because service notes often contain markup such as HTML, // we will convert all of the subtrees into a string, not just the direct child text and CDATA elements. - NodeList notes = objectTag.getElementsByTagNameNS(MobyPrefixResolver.MOBY_XML_NAMESPACE, - SERVICE_NOTES_ELEMENT); + NodeList notes = MobyPrefixResolver.getChildElements(objectTag, + SERVICE_NOTES_ELEMENT); if(notes.getLength() > 0){ StringBuffer notesText = new StringBuffer(); for(int i = 0; i < notes.getLength(); i++){ - notesText.append(((Element) notes.item(i))); + notesText.append(MobyObjectDecompositionImpl.getTextContent((Element) notes.item(i))); } setServiceNotes(notesText.toString()); } @@ -159,7 +163,7 @@ protected void parseDataGroup(Element dataGroupTag) throws MobyException{ String groupID = null; - Vector dataMembers = new Vector(); + HashMap dataMembers = new HashMap(); groupID = dataGroupTag.getAttributeNS(MobyPrefixResolver.MOBY_XML_NAMESPACE, ID_ATTR); if(groupID == null){ @@ -175,29 +179,14 @@ for(int j = 0; collections != null && j < collections.getLength(); j++){ if(debug && j == 0){ debugPS.println("There are " + collections.getLength() + - " simples in response " + groupID + - ", collection #" + j); + " collections in response " + groupID); } Element collectionTag = (Element) collections.item(j); - MobyDataObjectSet collection = new MobyDataObjectSet(MobyDataObject.getName(collectionTag)); - - // For each collection, find the simple children - NodeList subsimples = MobyPrefixResolver.getChildElements(collectionTag, "Simple"); - - // And add their values to the collection - MobyDataObject[] subout = new MobyDataObject[subsimples.getLength()]; - for(int k = 0; k < subsimples.getLength(); k++){ - if(debug && k == 0){ - debugPS.println("There are " + subsimples.getLength() + - " simples in response " + groupID + - ", collection #" + j); - } - subout[k] = (MobyDataObject) MobyDataObject.createInstanceFromDOM((Element) subsimples.item(k)); - } - collection.setElements(subout); + MobyDataObjectSet collection = (MobyDataObjectSet) (MobyDataObject.createInstanceFromDOM(collectionTag)); // Add completed collection to the output list - dataMembers.add(collection); + dataMembers.put(collection.getName(), collection); + } // Done fetching collections // Take all the top level simples and add them to the list @@ -210,16 +199,33 @@ if(debug && j == 0){ debugPS.println("There are " + simples.getLength() + " simples in the response"); } - dataMembers.add(MobyDataObject.createInstanceFromDOM((Element) simples.item(j))); + String name = MobyPrefixResolver.getAttr((Element) simples.item(j), "articleName"); + // A named member. Die if there is more than one with the same name + if(name != null){ + if(dataMembers.containsKey(name)){ + throw new MobyException("Illegal XML: there is more than one tag in the response " + + groupID + " with the articleName " + name); + } + dataMembers.put(name, MobyDataObject.createInstanceFromDOM((Element) simples.item(j))); + } + // No anonymous data member yet + else if(!dataMembers.containsKey("")){ + dataMembers.put("", MobyDataObject.createInstanceFromDOM((Element) simples.item(j))); + } + else{ + debugPS.println("More than one anonymous member, ignoring simple #" + j); + } } - // Now add the parameter + // Now add the secondary parameters NodeList parameters = MobyPrefixResolver.getChildElements(dataGroupTag, "Parameter"); for(int j = 0; parameters != null && j < parameters.getLength(); j++){ if(debug && j == 0){ - debugPS.println("There are " + parameters.getLength() + " simples in the response"); + debugPS.println("There are " + parameters.getLength() + " parameters in the response"); } - dataMembers.add(MobyDataObject.createInstanceFromDOM((Element) parameters.item(j))); + MobyDataSecondaryInstance paramObject = (MobyDataSecondaryInstance) + MobyDataObject.createInstanceFromDOM((Element) parameters.item(j)); + dataMembers.put(paramObject.getName(), paramObject); } put(groupID, dataMembers); @@ -271,7 +277,55 @@ } public String toXML(){ - return "stuff here"; + StringBuffer xml = new StringBuffer(" \n"); + if(serviceNotes != null){ + // Note: we should escape the service notes, in case they contain bad markup -> TODO + xml.append(" " + serviceNotes + ""); + } + + // print each query (or response as it may be) + Iterator queryIter = keySet().iterator(); + while(queryIter.hasNext()){ + // What's in the mobyData tag? + String queryName = (String) queryIter.next(); + xml.append(" "); + + AbstractMap queryParams = (AbstractMap) get(queryName); + // Print each parameter (the order is random) + Iterator paramIter = queryParams.keySet().iterator(); + + while(paramIter.hasNext()){ + String paramName = ((String) paramIter.next()); + MobyDataInstance dataObject = ((MobyDataInstance) queryParams.get(paramName)); + + int oldXmlMode = dataObject.getXmlMode(); + if(oldXmlMode != MobyDataInstance.SERVICE_XML_MODE){ + dataObject.setXmlMode(MobyDataInstance.SERVICE_XML_MODE); + } + + if(dataObject instanceof MobyDataObject){ + // This line should be replaced with a named field + xml.append(" "+ + dataObject.toXML()+ + ""); + } + else{ + xml.append(dataObject.toXML()); + } + + // Restore the old XML mode setting if not service mode + if(oldXmlMode != MobyDataInstance.SERVICE_XML_MODE){ + dataObject.setXmlMode(oldXmlMode); + } + } + + xml.append(" "); + } + + xml.append(" \n"); + return xml.toString(); } // Below, to the end of the class file, are the methods that must be @@ -344,7 +398,7 @@ //public MobyDataObject put(String fieldName, MobyDataObject value){ /** * @param queryID a unique ID for the query. If null, or not a String, or blank it will be auto-generated - * @param value + * @param value an AbstractMap of , where the string is the parameter name */ public Object put(Object queryID, Object value){ if(queryID == null || !(queryID instanceof String) || ((String) queryID).length() == 0){ =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2005/08/07 23:46:12 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2005/08/20 01:58:13 1.7 @@ -154,12 +154,23 @@ return new MobyDataSecondaryInstance(objectTag); } // Must otherwise be a composite - else{ + else{ return new MobyDataComposite(objectTag); } } /** + * Please note that you almost never want to call this method in a client. + * The articleName of a MOBY Ontology object is normally fully determined + * by either the parameter name in the service being called (MobyContentInstance + * handles this), or the member field name when included as part of a composite object + * (MobyDataComposite handles this). + */ + public void setName(String name){ + super.setName(name); + } + + /** * Similar to DOM level 3 getTextContent, but only elements are excepted as input, and text * inside children elements is not picked up. * Actually calls MobyObjectDecompositionImpl.getTextContent() =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2005/07/22 05:11:54 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2005/08/20 01:58:13 1.4 @@ -28,7 +28,12 @@ private int xmlMode = MobyDataInstance.SERVICE_XML_MODE; public MobyDataObjectSet(org.w3c.dom.Element e) throws MobyException{ - this(MobyDataObject.getName(e), getChildren(e)); + this(MobyDataObject.getName(e), getChildren(e)); + + if(getName() == null){ + throw new MobyException("Anonymous collections are not allowed (need articleName), input was :\n" + e); + } + } public static Collection getChildren(org.w3c.dom.Element e) throws MobyException{ @@ -98,7 +103,14 @@ bag.add(values[i]); } } - + + /** + * @return a Vector with the MobyDataObjects + */ + public Object getObject(){ + return bag; + } + /** * @return the MobyDataObjects that comprise the collection */ =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2005/08/15 17:41:41 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2005/08/20 01:58:13 1.5 @@ -40,6 +40,14 @@ public MobyDataSecondaryInstance(Element objectTag) throws MobyException{ // What is the parameter name? super(MobyDataObject.getName(objectTag)); + + if(getName() == null){ + throw new MobyException("Anonymous secondary parameters are not allowed (need articleName), input was :\n" + + objectTag); + } + if(getName().length() == 0){ + throw new MobyException("Secondary parameters with blank articleNames are not allowed, input was: " + objectTag); + } setDataType("String"); if(objectTag == null){ =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataUtils.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataUtils.java 2005/07/22 05:11:54 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataUtils.java 2005/08/20 01:58:13 1.2 @@ -1,5 +1,6 @@ package org.biomoby.shared.data; +import org.biomoby.shared.MobyPrefixResolver; import org.biomoby.shared.*; import org.w3c.dom.*; import java.io.*; @@ -14,14 +15,14 @@ public static boolean toXMLDocument(OutputStream os, MobyContentInstance mci) throws Exception{ // May want to check character encoding before doing getBytes(), implement this later os.write("\n".getBytes()); - os.write("\n".getBytes()); + os.write(("\n").getBytes()); os.write(mci.toXML().getBytes()); os.write("\n".getBytes()); return true; } - + public static MobyContentInstance fromXMLDocument(InputStream is) throws Exception{ - + // Load an XML document javax.xml.parsers.DocumentBuilder docBuilder = null; try{ From gordonp at pub.open-bio.org Fri Aug 19 21:58:13 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Fri Aug 19 22:42:58 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200158.j7K1wDJE027454@pub.open-bio.org> gordonp Fri Aug 19 21:58:13 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory pub.open-bio.org:/tmp/cvs-serv27410/src/main/org/biomoby/client Modified Files: MobyRequest.java Log Message: Updates to deal with requirements for named parameters in MOBY API 0.86, and some relaxing of this rule to allow existing anonymously parameterized one-input services to still be valid moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.15,1.16 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2005/08/07 23:46:12 1.15 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2005/08/20 01:58:13 1.16 @@ -2,6 +2,7 @@ // Defines Web service input, output, access import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.Hashtable; import java.util.Vector; @@ -42,8 +43,7 @@ public class MobyRequest{ protected MobyService mobyService = null; - protected MobyDataInstance[] inputData = null; - protected MobyDataSecondaryInstance[] secondaryData = null; + protected MobyContentInstance inputData = null; protected MobyContentInstance outputData = null; protected Central mobyCentral = null; protected PrefixResolver mobyPrefixResolver = null; @@ -187,37 +187,29 @@ * * @throws IllegalArgumentException if the input does not fit the criteria of the service (e.g. wrong data type) */ - public void setInput(MobyDataInstance[] data) throws IllegalArgumentException{ + public void setInput(MobyContentInstance data) throws MobyException{ inputData = data; } /** * Convenience method to run services that take one unnamed argument. */ - public void setInput(MobyDataInstance datum) throws IllegalArgumentException{ - inputData = new MobyDataInstance[1]; - inputData[0] = datum; + public void setInput(MobyDataInstance datum) throws MobyException{ + setInput(datum, ""); } /** - * @return the MobyService that will be executed when invokeService is called - */ - public MobyDataInstance[] getInput(){ - return inputData; - } - - /** - * @param params the list of secondary input values to pass to the service + * Convenience method to run services that take one named argument. */ - public void setSecondaryInput(MobyDataSecondaryInstance[] params) throws IllegalArgumentException{ - secondaryData = params; + public void setInput(MobyDataInstance datum, String paramName) throws MobyException{ + inputData = new MobyContentInstance(datum, paramName); } /** - * @return the list of secondary input values to pass to the service + * @return the MobyService that will be executed when invokeService is called */ - public MobyDataSecondaryInstance[] setSecondaryInput(){ - return secondaryData; + public MobyContentInstance getInput(){ + return inputData; } /** @@ -254,7 +246,7 @@ getServiceFromWSDL(); verifyInput(); - String mobyXML = convertMOBYDataToMOBYRequest(inputData, secondaryData); + String mobyXML = convertMOBYDataToMOBYRequest(inputData); Element mobyDOM = performSOAPRequest(mobyXML); // The following parses the DOM and extracts all the appropriate jMOBY objects to represent the XML in Java outputData = MobyDataUtils.fromXMLDocument(mobyDOM); @@ -320,23 +312,23 @@ * @throws MobyException if the number of input parameters was wrong, or the paramters were of the wrong type. */ protected void verifyInput() throws MobyException{ - MobyData[] requiredInputData = mobyService.getPrimaryInputs(); - + /*MobyData[] requiredInputData = mobyService.getPrimaryInputs(); + if(requiredInputData == null){ - if(inputData != null && inputData.length != 0){ + if(inputData != null && inputData.size() != 0){ throw new MobyException("Service invocation expects no input parameters, " + "but setInput has not been called with a null or zero-length array argument"); } return; // otherwise there are no parameters to check } - if(inputData == null || inputData.length == 0){ + if(inputData == null || inputData.size() == 0){ throw new MobyException("Service invocation expects " + requiredInputData.length + " input " + "parameters, but setInput has not been called to provide any input"); } if (requiredInputData.length != inputData.length){ throw new MobyException("Wrong number of input parameters to service invocation method: expected " + requiredInputData.length + ", but setInput was provided " + inputData.length); - } + }*/ // BUG WORKAROUND: Since the Moby-generated WSDL doesn't define the input, we assume the // data types are right, and we just have to check the number of them. @@ -623,10 +615,9 @@ return domDoc.getDocumentElement(); } - public String convertMOBYDataToMOBYRequest(MobyDataInstance data, MobyDataSecondaryInstance[] secondary) throws MobyException{ - MobyDataInstance[] mdsis = new MobyDataInstance[1]; - mdsis[0] = data; - return convertMOBYDataToMOBYRequest(mdsis, secondary); + public String convertMOBYDataToMOBYRequest(MobyDataInstance data) throws MobyException{ + // Create a mobyContent with an anonymous one-input mobyData + return convertMOBYDataToMOBYRequest(new MobyContentInstance(data, "")); } /** @@ -634,65 +625,25 @@ * * @return the XML representation of the input data */ - public String convertMOBYDataToMOBYRequest(MobyDataInstance[] data, MobyDataSecondaryInstance[] secondary) throws MobyException{ - // Start of envelope - String mobyRequest = "\n" + - " \n" + - " \n" + - ""; - - // Real input data payload - if(data != null){ - for(int i = 0; i < data.length; i++){ - int oldXmlMode = data[i].getXmlMode(); - if(oldXmlMode != MobyDataInstance.SERVICE_XML_MODE){ - data[i].setXmlMode(MobyDataInstance.SERVICE_XML_MODE); - } - - if(data[i] instanceof MobyDataObject){ - // This line should be replaced with a named field - mobyRequest += ""+ - ((MobyDataObject) data[i]).toXML()+ - ""; - } - else if(data[i] instanceof MobyDataObjectSet){ - mobyRequest += ((MobyDataObjectSet) data[i]).toXML(); - } - else{ - // Could just call toXML, but don't know if it has a Simple wrapper - // already or not, or even if it's a set. - throw new MobyException("Element #" + i + - " of the input data was not a " + - "MobyDataObject or a " + - "MobyDataObjectSet (found " + - data[i].getClass().getName() + ")"); - } - - // Restore the old XML mode setting if not service mode - if(oldXmlMode != MobyDataInstance.SERVICE_XML_MODE){ - data[i].setXmlMode(oldXmlMode); - } - } - } + public String convertMOBYDataToMOBYRequest(MobyContentInstance data) throws MobyException{ - // Now load all of the secondary parameters if there are any - if(secondary != null){ - for(int i = 0; i < secondary.length; i++){ - mobyRequest += secondary[i].toXML(); - } + ByteArrayOutputStream mobyRequest = new ByteArrayOutputStream(); + try{ + MobyDataUtils.toXMLDocument(mobyRequest, inputData); } - - // End of envelope - mobyRequest += - " \n" + - " \n" + - " \n"; + catch(MobyException me){ + throw me; + } + catch(Exception e){ + throw new MobyException("Could not create MOBY payload XML from input data: " +e); + } + if(debug){ debugPS.println("Input to MOBY Service is:"); - debugPS.print(mobyRequest); + debugPS.print(mobyRequest.toString()); } - return mobyRequest; + return mobyRequest.toString(); } /** From gordonp at pub.open-bio.org Fri Aug 19 22:24:10 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Fri Aug 19 23:08:57 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200224.j7K2OAkN027602@pub.open-bio.org> gordonp Fri Aug 19 22:24:10 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv27577/docs Modified Files: SimpleClient.html Log Message: Updates to deal with requirements for named parameters in MOBY API 0.86, and some relaxing of this rule to allow existing anonymously parameterized one-input services to still be valid moby-live/Java/docs SimpleClient.html,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/09 19:40:56 1.10 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/20 02:24:10 1.11 @@ -371,7 +371,7 @@ will be blank. This data envelope is then made into a proper XML file, with declarations and all, by MobyDataUtils. -

    MobyDataUtils.toXMLDocument(System.out, new MobyContentInstance(null, null));
    +
    MobyDataUtils.toXMLDocument(System.out, new MobyContentInstance(null));

    Create a MOBY XML response or query with a single data object

    @@ -382,9 +382,26 @@ to form a valid content envelope.
    MobyDataUtils.toXMLDocument(System.out, new MobyContentInstance(new - MobyDataObject("gi", "100089"), null));
    + MobyDataObject("gi", "100089")));
    +

    +

    + If the service requires a named parameter rather than an anonymous one, the two argument constructor can be used: + +

    MobyDataUtils.toXMLDocument(System.out, new MobyContentInstance(new + MobyDataObject("SGD", "S0000221"), "interactorID"));
    +

    + +

    + There are also similar methods in MobyRequest to deal with anonymous and non-anonymous single parameter services: + +

    +mobyRequest.setInput(MobyDataObject("gi", "100089"));
    +     
    +mobyRequest.setInput(MobyDataObject("SGD", "S0000221"), "interactorID"));
    +
    +

    Create a MOBY XML response or query envelope with multiple invocations

    Use the default constructor for MobyContentInstance, then add at least one MobyDataInstance @@ -394,8 +411,8 @@ as input.

     MobyContentInstance queries = new MobyContentInstance();
    -data.put(new MobyDataObject("gi", "100089"));
    -data.put(new MobyDataObject("gi", "324442"));
    +queries.put(new MobyDataObject("gi", "100089"));
    +queries.put(new MobyDataObject("gi", "324442"));
     MobyDataUtils.toXMLDocument(System.out, queries);
     
    From gordonp at pub.open-bio.org Fri Aug 19 22:27:04 2005 From: gordonp at pub.open-bio.org (Paul Gordon) Date: Fri Aug 19 23:11:10 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200227.j7K2R457027648@pub.open-bio.org> gordonp Fri Aug 19 22:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv27623/docs Modified Files: SimpleClient.html Log Message: moby-live/Java/docs SimpleClient.html,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/SimpleClient.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/20 02:24:10 1.11 +++ /home/repository/moby/moby-live/Java/docs/SimpleClient.html 2005/08/20 02:27:04 1.12 @@ -399,7 +399,7 @@
     mobyRequest.setInput(MobyDataObject("gi", "100089"));
          
    -mobyRequest.setInput(MobyDataObject("SGD", "S0000221"), "interactorID"));
    +mobyRequest.setInput(MobyDataObject("SGD", "S0000221"), "interactorID");
     

    Create a MOBY XML response or query envelope with multiple invocations

    From senger at pub.open-bio.org Sat Aug 20 05:26:45 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 20 06:11:35 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200926.j7K9Qjw2028823@pub.open-bio.org> senger Sat Aug 20 05:26:44 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated In directory pub.open-bio.org:/tmp/cvs-serv28781/org/biomoby/service/generated Removed Files: Echo.java EchoService.java EchoServiceLocator.java EchoStringSoapBindingImpl.java EchoStringSoapBindingStub.java deploy.wsdd undeploy.wsdd Log Message: moby-live/Java/src/Services/org/biomoby/service/generated Echo.java,1.1,NONE EchoService.java,1.1,NONE EchoServiceLocator.java,1.2,NONE EchoStringSoapBindingImpl.java,1.1,NONE EchoStringSoapBindingStub.java,1.2,NONE deploy.wsdd,1.1,NONE undeploy.wsdd,1.1,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated/RCS/Echo.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated/RCS/EchoService.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated/RCS/EchoServiceLocator.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated/RCS/EchoStringSoapBindingImpl.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated/RCS/EchoStringSoapBindingStub.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated/RCS/deploy.wsdd,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/generated/RCS/undeploy.wsdd,v: No such file or directory From senger at pub.open-bio.org Sat Aug 20 05:26:44 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 20 06:11:41 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200926.j7K9QiIB028800@pub.open-bio.org> senger Sat Aug 20 05:26:44 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service In directory pub.open-bio.org:/tmp/cvs-serv28781/org/biomoby/service Modified Files: package.html Log Message: moby-live/Java/src/Services/org/biomoby/service package.html,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/package.html 2005/05/19 15:57:25 1.1 +++ /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/package.html 2005/08/20 09:26:44 1.2 @@ -4,6 +4,7 @@ + + From senger at pub.open-bio.org Sat Aug 20 05:34:21 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 20 06:19:33 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200934.j7K9YLu9028907@pub.open-bio.org> senger Sat Aug 20 05:34:20 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service In directory pub.open-bio.org:/tmp/cvs-serv28876/org/biomoby/service Removed Files: package.html Log Message: moby-live/Java/src/Services/org/biomoby/service package.html,1.2,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/Services/org/biomoby/service/RCS/package.html,v: No such file or directory From senger at pub.open-bio.org Sat Aug 20 05:34:20 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 20 06:19:41 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508200934.j7K9YKU3028891@pub.open-bio.org> senger Sat Aug 20 05:34:20 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Services In directory pub.open-bio.org:/tmp/cvs-serv28876 Added Files: _README_ Log Message: moby-live/Java/src/Services _README_,NONE,1.1 From mwilkinson at pub.open-bio.org Tue Aug 23 13:37:46 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 14:21:34 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231737.j7NHbkJY022387@pub.open-bio.org> mwilkinson Tue Aug 23 13:37:46 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi In directory pub.open-bio.org:/tmp/cvs-serv22349/MOBY/Adaptor/moby/queryapi Modified Files: mysql.pm Log Message: relationships being queried from object ontology server. ugh moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.70,1.71 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/08/17 19:30:18 1.70 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/08/23 17:37:46 1.71 @@ -1320,13 +1320,8 @@ my $dbh = $self->dbh; my $direction = $args{'direction'}; my $ontology = $args{'ontology'}; - my $relationship = $args{'relationship'}; + my $relationship = $args{'relationship'}; # this is assumed to be an LSID - if ($relationship){ # need it as an lsid - my $result = $self->query_relationship(type => $relationship, ontology => $ontology); - my $row = shift @$result; - $relationship = $row->{relationship_lsid}; - } my $type = $args{'term'}; return 0 unless $type; my $lsid; From mwilkinson at pub.open-bio.org Tue Aug 23 14:04:59 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 14:48:37 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231804.j7NI4xVQ022507@pub.open-bio.org> mwilkinson Tue Aug 23 14:04:59 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv22488/MOBY Modified Files: OntologyServer.pm Log Message: not querying hasa relationships to correctly identify identical articlenames moby-live/Perl/MOBY OntologyServer.pm,1.74,1.75 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 17:37:46 1.74 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:04:59 1.75 @@ -514,10 +514,11 @@ # case insensitive? my $OS = MOBY::OntologyServer->new(ontology => 'object'); my $OSrel = MOBY::OntologyServer->new(ontology => 'relationship'); - my ($exists1, $desc, $isalsid) = $OSrel->relationshipExists(term => 'isa'); - my ($exists2, $desc2, $hasalsid) = $OSrel->relationshipExists(term => 'hasa'); - my ($exists3, $desc3, $haslsid) = $OSrel->relationshipExists(term => 'has'); + my ($exists1, $desc, $isalsid) = $OSrel->relationshipExists(term => 'isa', ontology => 'object'); + my ($exists2, $desc2, $hasalsid) = $OSrel->relationshipExists(term => 'hasa', ontology => 'object'); + my ($exists3, $desc3, $haslsid) = $OSrel->relationshipExists(term => 'has', ontology => 'object'); + return 1 unless ($exists1 && $exists2 && $exists3); # this is bad, since it returns boolean suggesting that it found a common articlename rather than finding that a given relationship doesn't exist, but... hey.... my $relationships = $OS->Relationships( ontology => 'object', term => $args{term}, @@ -526,6 +527,7 @@ expand => 1); #relationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] my ($isa) = keys(%$relationships); # can only be one key returned, and must be isa in this case + return 1 unless $relationships->{$isa}; my @ISAlist = @{$relationships->{$isa}}; foreach my $ISA(@ISAlist){ # $ISA = [lsid, articleName] (but articleName shuld be null anyway in this case) my $what_it_is = shift @$ISA; From mwilkinson at pub.open-bio.org Tue Aug 23 14:13:30 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 14:57:08 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231813.j7NIDUeJ022595@pub.open-bio.org> mwilkinson Tue Aug 23 14:13:30 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv22576/MOBY Modified Files: OntologyServer.pm Log Message: don't assume that there will be has and hasa relationships at all moby-live/Perl/MOBY OntologyServer.pm,1.75,1.76 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:04:59 1.75 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:13:30 1.76 @@ -537,11 +537,15 @@ relationship => $hasalsid, direction => 'root', ); - #$hasarelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] - my ($hasa) = keys(%$hasarelationships); - my @HASAlist = @{$hasarelationships->{$hasa}}; - foreach my $HASA(@HASAlist){ - $foundCommonArticleNameFlag = 1 if ($HASA->[1] eq $articleName); + if ($hasarelationships){ + #$hasarelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] + my ($hasa) = keys(%$hasarelationships); + if ($hasarelationships->{$hasa}){ + my @HASAlist = @{$hasarelationships->{$hasa}}; + foreach my $HASA(@HASAlist){ + $foundCommonArticleNameFlag = 1 if ($HASA->[1] eq $articleName); + } + } } my $hasrelationships = $OS->Relationships( ontology => 'object', @@ -549,12 +553,16 @@ relationship => $haslsid, direction => 'root', ); - #$hasrelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] - my ($has) = keys(%$hasrelationships); - my @HASlist = @{$hasrelationships->{$has}}; - foreach my $HAS(@HASlist){ - $foundCommonArticleNameFlag = 1 if ($HAS->[1] eq $articleName); - } + if ($hasrelationships){ + #$hasrelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] + my ($has) = keys(%$hasrelationships); + if ($hasrelationships->{$has}){ + my @HASlist = @{$hasrelationships->{$has}}; + foreach my $HAS(@HASlist){ + $foundCommonArticleNameFlag = 1 if ($HAS->[1] eq $articleName); + } + } + } } return $foundCommonArticleNameFlag; } From mwilkinson at pub.open-bio.org Tue Aug 23 14:22:28 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 15:07:29 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231822.j7NIMSI6022670@pub.open-bio.org> mwilkinson Tue Aug 23 14:22:28 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv22651/MOBY Modified Files: OntologyServer.pm Log Message: don't assume that there will be isa relationships either moby-live/Perl/MOBY OntologyServer.pm,1.76,1.77 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:13:30 1.76 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:22:28 1.77 @@ -527,8 +527,8 @@ expand => 1); #relationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] my ($isa) = keys(%$relationships); # can only be one key returned, and must be isa in this case - return 1 unless $relationships->{$isa}; - my @ISAlist = @{$relationships->{$isa}}; + my @ISAlist; + (@ISAlist = @{$relationships->{$isa}}) if ($relationships->{$isa}) ; foreach my $ISA(@ISAlist){ # $ISA = [lsid, articleName] (but articleName shuld be null anyway in this case) my $what_it_is = shift @$ISA; my $hasarelationships = $OS->Relationships( From mwilkinson at pub.open-bio.org Tue Aug 23 14:26:21 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 15:10:00 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231826.j7NIQLpA022740@pub.open-bio.org> mwilkinson Tue Aug 23 14:26:20 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv22721/t Modified Files: Client-Central.t Log Message: add test for identical articleName at same XML level - should fail object registration moby-live/Perl/t Client-Central.t,1.30,1.31 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/17 17:59:24 1.30 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/23 18:26:20 1.31 @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; #use SOAP::Lite +trace; -use Test::More tests => 127; # perldoc Test::More for details +use Test::More tests => 128; # perldoc Test::More for details # Test 1 BEGIN { use_ok('MOBY::Client::Central') }; @@ -30,7 +30,7 @@ ################## MOBY Registration Tests ################# -# Test 3 inherits from two isas - should fail +# Test inherits from two isas - should fail $r = $C->registerObjectClass(objectType => "Rubbish", description => "a human-readable description of the object", contactEmail => 'your@email.address', @@ -65,7 +65,7 @@ -# Test 4 should succeed +# Test Good registration should succeed $r = $C->registerObjectClass(objectType => "Rubbish", description => "a human-readable description of the object", contactEmail => 'your@email.address', @@ -80,10 +80,22 @@ or diag("Object registration failure: ".$r->message)); +# Test Should end up with identical articleName at same level and therefore fail +$r = $C->registerObjectClass(objectType => "Rubbish2", + description => "a human-readable description of the object", + contactEmail => 'your@email.address', + authURI => "test.suite.com", + Relationships => { + ISA => [ + ['Rubbish', 'article1']], + HASA => [ + ['Object', 'articleName3']]} + ); +( ok($r->success,"Object registration correctly failed with identical articlename at same level of XML") + or diag("Object registration should have failed with identical articleName at same XML level, but didn't: ".$r->message)); - -# Test 5 +# Test 6 $r = $C->deregisterObjectClass(objectType => "Rubbish"); ( ok($r->success,"Object deregistration successful")) or diag("Object deregistration failure: ".$r->message) ; From mwilkinson at pub.open-bio.org Tue Aug 23 14:47:17 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 15:30:57 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231847.j7NIlHKG022845@pub.open-bio.org> mwilkinson Tue Aug 23 14:47:16 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv22826/MOBY Modified Files: OntologyServer.pm Log Message: failed to detect idential articleNames if the ISA relationshp was registered after the HASA moby-live/Perl/MOBY OntologyServer.pm,1.77,1.78 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.77 retrieving revision 1.78 diff -u -r1.77 -r1.78 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:22:28 1.77 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:47:16 1.78 @@ -485,10 +485,8 @@ '' ); # need to ensure that identical article names dont' end up at the same level - unless ($rel_lsid =~ /urn\:lsid\:biomoby\.org\:objectrelation\:isa/){ - my $articleNameInvalid = &_testIdenticalArticleName(term => $subj_lsid, articleName => $args{articleName}); - return (0, "Object will have conflicting articleName", '') if $articleNameInvalid; - } + my $articleNameInvalid = &_testIdenticalArticleName(term => $subj_lsid, articleName => $args{articleName}); + return (0, "Object will have conflicting articleName", '') if $articleNameInvalid; my $insertid = $adaptor->insert_object_term2term(relationship_type => $rel_lsid, object1_type => $subj_lsid, From mwilkinson at pub.open-bio.org Tue Aug 23 15:07:30 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 15:51:08 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231907.j7NJ7UJh022942@pub.open-bio.org> mwilkinson Tue Aug 23 15:07:30 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv22923/MOBY Modified Files: OntologyServer.pm Log Message: updating test suite to test all possible ways of getting identical artileNames in an object registration - inheritence, identical has or hasa relationships moby-live/Perl/MOBY OntologyServer.pm,1.78,1.79 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 18:47:16 1.78 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 19:07:29 1.79 @@ -486,7 +486,7 @@ # need to ensure that identical article names dont' end up at the same level my $articleNameInvalid = &_testIdenticalArticleName(term => $subj_lsid, articleName => $args{articleName}); - return (0, "Object will have conflicting articleName", '') if $articleNameInvalid; + return (0, "Object will have conflicting articleName ".($args{articleName}), '') if $articleNameInvalid; my $insertid = $adaptor->insert_object_term2term(relationship_type => $rel_lsid, object1_type => $subj_lsid, From mwilkinson at pub.open-bio.org Tue Aug 23 15:07:30 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 15:51:09 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231907.j7NJ7U2Z022961@pub.open-bio.org> mwilkinson Tue Aug 23 15:07:30 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv22923/t Modified Files: Client-Central.t Log Message: updating test suite to test all possible ways of getting identical artileNames in an object registration - inheritence, identical has or hasa relationships moby-live/Perl/t Client-Central.t,1.31,1.32 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/23 18:26:20 1.31 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/23 19:07:30 1.32 @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; #use SOAP::Lite +trace; -use Test::More tests => 128; # perldoc Test::More for details +use Test::More tests => 131; # perldoc Test::More for details # Test 1 BEGIN { use_ok('MOBY::Client::Central') }; @@ -37,8 +37,8 @@ authURI => "test.suite.com", Relationships => { ISA => [ - ['Object', 'article1'], - ['Object', 'articleName2']], + ['Object', ''], + ['Object', '']], HASA => [ ['Object', 'articleName3']]} ); @@ -54,7 +54,7 @@ authURI => "test.suite.com", Relationships => { ISA => [ - ['String', 'article1'], + ['String', ''], ], HASA => [ ['Object', 'articleName3']]} @@ -72,7 +72,7 @@ authURI => "test.suite.com", Relationships => { ISA => [ - ['Object', 'article1']], + ['Object', '']], HASA => [ ['Object', 'articleName3']]} ); @@ -80,22 +80,85 @@ or diag("Object registration failure: ".$r->message)); -# Test Should end up with identical articleName at same level and therefore fail +# Test Should end up with identical articleName at same level and therefore fail (by inheritence) +$r = $C->registerObjectClass(objectType => "Rubbish2", + description => "a human-readable description of the object", + contactEmail => 'your@email.address', + authURI => "test.suite.com", + Relationships => { + ISA => [ + ['Rubbish', '']], + HASA => [ + ['Object', 'articleName3']]} + ); +( ok(!$r->success,"Object registration correctly failed with identical articlename at same level of XML") + or diag("Object registration should have failed with identical articleName at same XML level by inheritence, but didn't: ".$r->message)); + + +# Test Should end up with identical articleName at same level and therefore fail (by double identical HASAs) +$r = $C->registerObjectClass(objectType => "Rubbish2", + description => "a human-readable description of the object", + contactEmail => 'your@email.address', + authURI => "test.suite.com", + Relationships => { + ISA => [ + ['Object', '']], + HASA => [ + ['Object', 'articleName3'], + ['Object', 'articleName3']]} + ); +( ok(!$r->success,"Object registration correctly failed with identical articlename at same level of XML") + or diag("Object registration should have failed with identical articleName at same XML level by identical hasas, but didn't: ".$r->message)); + +# Test Should end up with identical articleName at same level and therefore fail (by double non-identical HASAs) +$r = $C->registerObjectClass(objectType => "Rubbish2", + description => "a human-readable description of the object", + contactEmail => 'your@email.address', + authURI => "test.suite.com", + Relationships => { + ISA => [ + ['Object', '']], + HASA => [ + ['Integer', 'articleName3'], + ['Object', 'articleName3']]} + ); +( ok(!$r->success,"Object registration correctly failed with identical articlename at same level of XML") + or diag("Object registration should have failed with identical articleName at same XML level by non-identical hasas, but didn't: ".$r->message)); + + +# Test Should end up with identical articleName at same level and therefore fail (by double non-identical HASs) +$r = $C->registerObjectClass(objectType => "Rubbish2", + description => "a human-readable description of the object", + contactEmail => 'your@email.address', + authURI => "test.suite.com", + Relationships => { + ISA => [ + ['Object', '']], + HAS => [ + ['Integer', 'articleName3'], + ['Object', 'articleName3']]} + ); +( ok(!$r->success,"Object registration correctly failed with identical articlename at same level of XML") + or diag("Object registration should have failed with identical articleName at same XML level by identical hass, but didn't: ".$r->message)); + +# Test Should end up with identical articleName at same level and therefore fail (by identical HAS/HASA) $r = $C->registerObjectClass(objectType => "Rubbish2", description => "a human-readable description of the object", contactEmail => 'your@email.address', authURI => "test.suite.com", Relationships => { ISA => [ - ['Rubbish', 'article1']], + ['Object', '']], HASA => [ + ['Object', 'articleName3']], + HAS => [ ['Object', 'articleName3']]} ); -( ok($r->success,"Object registration correctly failed with identical articlename at same level of XML") - or diag("Object registration should have failed with identical articleName at same XML level, but didn't: ".$r->message)); +( ok(!$r->success,"Object registration correctly failed with identical articlename at same level of XML") + or diag("Object registration should have failed with identical articleName at same XML level by hasa/has, but didn't: ".$r->message)); -# Test 6 +# Test $r = $C->deregisterObjectClass(objectType => "Rubbish"); ( ok($r->success,"Object deregistration successful")) or diag("Object deregistration failure: ".$r->message) ; From mwilkinson at pub.open-bio.org Tue Aug 23 15:38:07 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 16:21:48 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231938.j7NJc7rp023081@pub.open-bio.org> mwilkinson Tue Aug 23 15:38:07 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv23062/MOBY Modified Files: Central.pm Log Message: can't get out of checking the inheritence in order ISA, HAS, HASA, otherwise it will fail in some cases. Order of addition of relationships is now ISA HASA HAS moby-live/Perl/MOBY Central.pm,1.203,1.204 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.203 retrieving revision 1.204 diff -u -r1.203 -r1.204 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/17 19:30:18 1.203 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 19:38:07 1.204 @@ -22,7 +22,7 @@ use MOBY::secondary_input; use MOBY::central_db_connection; use MOBY::Config; -#use MOBY::Client::Central; +use MOBY::CommonSubs; #use MOBY::RDF::ServiceInstanceRDF; #use RDF::Core; @@ -365,8 +365,9 @@ ($success == 0) && return &_error( $message, $URI ); my @failures; my $messages = ""; - if ( keys %{$relationships} ) { - while ( my ( $reltype, $obj ) = each %{$relationships} ) { + if ( keys %{$relationships} ) { # need to pull them out with ISA's first + foreach my $reltype(qw{ISA HASA HAS}){ + my ( $obj ) = $relationships->{$reltype}; foreach ( @{$obj} ) { my ( $objectType, $articleName ) = @{$_}; my ( $success, $message ) = From mwilkinson at pub.open-bio.org Tue Aug 23 15:38:07 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 16:22:11 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508231938.j7NJc79a023100@pub.open-bio.org> mwilkinson Tue Aug 23 15:38:07 EDT 2005 Update of /home/repository/moby/moby-live/Perl/t In directory pub.open-bio.org:/tmp/cvs-serv23062/t Modified Files: Client-Central.t Log Message: can't get out of checking the inheritence in order ISA, HAS, HASA, otherwise it will fail in some cases. Order of addition of relationships is now ISA HASA HAS moby-live/Perl/t Client-Central.t,1.32,1.33 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/23 19:07:30 1.32 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/08/23 19:38:07 1.33 @@ -96,7 +96,7 @@ # Test Should end up with identical articleName at same level and therefore fail (by double identical HASAs) -$r = $C->registerObjectClass(objectType => "Rubbish2", +$r = $C->registerObjectClass(objectType => "Rubbish3", description => "a human-readable description of the object", contactEmail => 'your@email.address', authURI => "test.suite.com", @@ -111,7 +111,7 @@ or diag("Object registration should have failed with identical articleName at same XML level by identical hasas, but didn't: ".$r->message)); # Test Should end up with identical articleName at same level and therefore fail (by double non-identical HASAs) -$r = $C->registerObjectClass(objectType => "Rubbish2", +$r = $C->registerObjectClass(objectType => "Rubbish4", description => "a human-readable description of the object", contactEmail => 'your@email.address', authURI => "test.suite.com", @@ -127,7 +127,7 @@ # Test Should end up with identical articleName at same level and therefore fail (by double non-identical HASs) -$r = $C->registerObjectClass(objectType => "Rubbish2", +$r = $C->registerObjectClass(objectType => "Rubbish5", description => "a human-readable description of the object", contactEmail => 'your@email.address', authURI => "test.suite.com", @@ -142,7 +142,7 @@ or diag("Object registration should have failed with identical articleName at same XML level by identical hass, but didn't: ".$r->message)); # Test Should end up with identical articleName at same level and therefore fail (by identical HAS/HASA) -$r = $C->registerObjectClass(objectType => "Rubbish2", +$r = $C->registerObjectClass(objectType => "Rubbish6", description => "a human-readable description of the object", contactEmail => 'your@email.address', authURI => "test.suite.com", From mwilkinson at pub.open-bio.org Tue Aug 23 17:58:38 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 18:42:15 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508232158.j7NLwcua023473@pub.open-bio.org> mwilkinson Tue Aug 23 17:58:38 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv23454/MOBY Modified Files: OntologyServer.pm Log Message: can't get out of checking the inheritence in order ISA, HAS, HASA, otherwise it will fail in some cases. Order of addition of relationships is now ISA HASA HAS moby-live/Perl/MOBY OntologyServer.pm,1.79,1.80 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 19:07:29 1.79 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 21:58:38 1.80 @@ -517,6 +517,12 @@ my ($exists3, $desc3, $haslsid) = $OSrel->relationshipExists(term => 'has', ontology => 'object'); return 1 unless ($exists1 && $exists2 && $exists3); # this is bad, since it returns boolean suggesting that it found a common articlename rather than finding that a given relationship doesn't exist, but... hey.... + # check the hasa relationships for common articleName + $foundCommonArticleNameFlag += _compareArticleNames(OS => $OS, type => $args{term}, relationship => $hasalsid, targetArticleName => $articleName); + # check the has relationships for common articleName + $foundCommonArticleNameFlag += _compareArticleNames(OS => $OS, type => $args{term}, relationship => $haslsid, targetArticleName => $articleName); + + # now get all of its inherited parents my $relationships = $OS->Relationships( ontology => 'object', term => $args{term}, @@ -527,40 +533,39 @@ my ($isa) = keys(%$relationships); # can only be one key returned, and must be isa in this case my @ISAlist; (@ISAlist = @{$relationships->{$isa}}) if ($relationships->{$isa}) ; + # for each of the inherited parents, check their articleNames foreach my $ISA(@ISAlist){ # $ISA = [lsid, articleName] (but articleName shuld be null anyway in this case) my $what_it_is = shift @$ISA; - my $hasarelationships = $OS->Relationships( - ontology => 'object', - term => $what_it_is, - relationship => $hasalsid, - direction => 'root', - ); - if ($hasarelationships){ - #$hasarelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] - my ($hasa) = keys(%$hasarelationships); - if ($hasarelationships->{$hasa}){ - my @HASAlist = @{$hasarelationships->{$hasa}}; - foreach my $HASA(@HASAlist){ - $foundCommonArticleNameFlag = 1 if ($HASA->[1] eq $articleName); - } - } - } - my $hasrelationships = $OS->Relationships( - ontology => 'object', - term => $what_it_is, - relationship => $haslsid, - direction => 'root', - ); - if ($hasrelationships){ - #$hasrelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] - my ($has) = keys(%$hasrelationships); - if ($hasrelationships->{$has}){ - my @HASlist = @{$hasrelationships->{$has}}; - foreach my $HAS(@HASlist){ - $foundCommonArticleNameFlag = 1 if ($HAS->[1] eq $articleName); + # check the hasa relationships for common articleName + $foundCommonArticleNameFlag += _compareArticleNames(OS => $OS, type => $what_it_is, relationship => $hasalsid, targetArticleName => $articleName); + # check the has relationships for common articleName + $foundCommonArticleNameFlag += _compareArticleNames(OS => $OS, type => $what_it_is, relationship => $haslsid, targetArticleName => $articleName); + } + return $foundCommonArticleNameFlag; +} + +sub _compareArticleNames { + my (%args) = @_; + my $OS = $args{OS}; + my $what_it_is = $args{type}; + my $lsid = $args{relationshipLSID}; + my $targetArticleName = $args{targetArticleName}; + my $foundCommonArticleNameFlag = 0; + my $contents = $OS->Relationships( + ontology => 'object', + term => $what_it_is, + relationship => $lsid, + direction => 'root', + ); + if ($contents){ + #$hasarelationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] + my ($content) = keys(%$contents); + if ($contents->{$content}){ + my @CONTENTlist = @{$contents->{$content}}; + foreach my $CONTAINED(@CONTENTlist){ + $foundCommonArticleNameFlag = 1 if ($CONTAINED->[1] eq $targetArticleName); #->[1] is the articleName field } - } - } + } } return $foundCommonArticleNameFlag; } From mwilkinson at pub.open-bio.org Tue Aug 23 18:35:21 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 19:20:25 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508232235.j7NMZLCT023599@pub.open-bio.org> mwilkinson Tue Aug 23 18:35:21 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv23580/MOBY Modified Files: OntologyServer.pm Log Message: inconsistently finding or not finding the identical articleName. mis-named variable and hashes coming out in funny orders. moby-live/Perl/MOBY OntologyServer.pm,1.80,1.81 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 21:58:38 1.80 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2005/08/23 22:35:21 1.81 @@ -548,7 +548,7 @@ my (%args) = @_; my $OS = $args{OS}; my $what_it_is = $args{type}; - my $lsid = $args{relationshipLSID}; + my $lsid = $args{relationship}; my $targetArticleName = $args{targetArticleName}; my $foundCommonArticleNameFlag = 0; my $contents = $OS->Relationships( From mwilkinson at pub.open-bio.org Tue Aug 23 19:16:05 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 19:59:42 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508232316.j7NNG5LM023736@pub.open-bio.org> mwilkinson Tue Aug 23 19:16:05 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv23717/MOBY Modified Files: Central.pm Log Message: should now accurately check the entire inheritence tree to ensure that we cannot register any objects that inherit directly or even indirectly from a primitive. Thus our deprecated objects cannot be extended anymore moby-live/Perl/MOBY Central.pm,1.204,1.205 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.204 retrieving revision 1.205 diff -u -r1.204 -r1.205 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 19:38:07 1.204 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 23:16:05 1.205 @@ -352,7 +352,6 @@ } } - # should be good to go now... @@ -454,11 +453,40 @@ } sub _testObjectTypeAgainstPrimitives{ + # THIS SUBROUTINE NEEDS TO BE REMOVED AND PLACED INTO THE ONTOLOGY SERVER + # one day when MOBY Central and the ontologies are separated properly my ($type) = @_; + my $OS = MOBY::OntologyServer->new(ontology => 'object'); + # get the inputlsid + my ($success, $desc, $inputlsid) = $OS->objectExists(term => $type); + my $CONF = MOBY::Config->new; my @primitives = @{$CONF->primitive_datatypes}; # get the list of known primitive datatypes my $x = 0; # set flag down - map {($x=1) if ($type eq $_)} @primitives; # test primitives against this one + # convert everything to an LSID first + + my @primitive_lsids = map{my ($s, $d, $l) = $OS->objectExists(term => $_); return $l} @primitives; + + map {($x=1) if ($inputlsid eq $_)} @primitive_lsids; # test primitives against this one + + my $OSrel = MOBY::OntologyServer->new(ontology => 'relationship'); + my ($exists1, $desc2, $isalsid) = $OSrel->relationshipExists(term => 'isa', ontology => 'object'); + + my $relationships = $OS->Relationships( + ontology => 'object', + term => $type, + relationship => $isalsid, + direction => 'root', + expand => 1); + #relationships{relationship} = [[lsid1,articleNmae], [lsid2, articleName], [lsid3, articleName]] + my ($isa) = keys(%$relationships); # can only be one key returned, and must be isa in this case + my @ISAlist; + (@ISAlist = @{$relationships->{$isa}}) if ($relationships->{$isa}) ; + # for each of the inherited parents, check their articleNames + foreach my $ISA(@ISAlist){ # $ISA = [lsid, articleName] (but articleName shuld be null anyway in this case) + my $what_it_is = shift @$ISA; + map {($x=1) if ($what_it_is eq $_)} @primitive_lsids; # test primitives against this one + } return $x; # return flag state } From mwilkinson at pub.open-bio.org Tue Aug 23 19:37:53 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 20:22:07 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508232337.j7NNbrld023831@pub.open-bio.org> mwilkinson Tue Aug 23 19:37:53 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv23812/MOBY Modified Files: Central.pm Log Message: oops. put a 'return' in my map function instead of just taking the return value moby-live/Perl/MOBY Central.pm,1.205,1.206 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.205 retrieving revision 1.206 diff -u -r1.205 -r1.206 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 23:16:05 1.205 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 23:37:53 1.206 @@ -10,7 +10,7 @@ use strict; use Carp; use vars qw($AUTOLOAD $WSDL_TEMPLATE); -use XML::LibXML; +#use XML::LibXML; use MOBY::OntologyServer; use MOBY::service_type; use MOBY::authority; @@ -22,7 +22,7 @@ use MOBY::secondary_input; use MOBY::central_db_connection; use MOBY::Config; -use MOBY::CommonSubs; +#use MOBY::CommonSubs; #use MOBY::RDF::ServiceInstanceRDF; #use RDF::Core; @@ -465,7 +465,7 @@ my $x = 0; # set flag down # convert everything to an LSID first - my @primitive_lsids = map{my ($s, $d, $l) = $OS->objectExists(term => $_); return $l} @primitives; + my @primitive_lsids = map{my ($s, $d, $l) = $OS->objectExists(term => $_); $l} @primitives; map {($x=1) if ($inputlsid eq $_)} @primitive_lsids; # test primitives against this one From mwilkinson at pub.open-bio.org Tue Aug 23 19:38:10 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Aug 23 20:22:18 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508232338.j7NNcAma023875@pub.open-bio.org> mwilkinson Tue Aug 23 19:38:10 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv23856/MOBY Modified Files: Central.pm Log Message: oops. put a 'return' in my map function instead of just taking the return value moby-live/Perl/MOBY Central.pm,1.206,1.207 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.206 retrieving revision 1.207 diff -u -r1.206 -r1.207 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 23:37:53 1.206 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 23:38:10 1.207 @@ -10,7 +10,7 @@ use strict; use Carp; use vars qw($AUTOLOAD $WSDL_TEMPLATE); -#use XML::LibXML; +use XML::LibXML; use MOBY::OntologyServer; use MOBY::service_type; use MOBY::authority; @@ -22,7 +22,7 @@ use MOBY::secondary_input; use MOBY::central_db_connection; use MOBY::Config; -#use MOBY::CommonSubs; +use MOBY::CommonSubs; #use MOBY::RDF::ServiceInstanceRDF; #use RDF::Core; From senger at pub.open-bio.org Wed Aug 24 10:24:18 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Wed Aug 24 11:07:58 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508241424.j7OEOIWF026579@pub.open-bio.org> senger Wed Aug 24 10:24:18 EDT 2005 Update of /home/repository/moby/jars-archive/current In directory pub.open-bio.org:/tmp/cvs-serv26560 Modified Files: jdom.jar Added Files: alltools2.jar Log Message: jars-archive/current alltools2.jar,NONE,1.1 jdom.jar,1.1,1.2 =================================================================== RCS file: /home/repository/moby/jars-archive/current/jdom.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 Binary files /home/repository/moby/jars-archive/current/jdom.jar 2005/06/10 13:55:35 1.1 and /home/repository/moby/jars-archive/current/jdom.jar 2005/08/24 14:24:18 1.2 differ rcsdiff: /home/repository/moby/jars-archive/current/jdom.jar: diff failed From mwilkinson at pub.open-bio.org Wed Aug 24 11:45:27 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Wed Aug 24 12:29:32 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508241545.j7OFjRFE026829@pub.open-bio.org> mwilkinson Wed Aug 24 11:45:27 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv26810/MOBY Modified Files: Central.pm Log Message: fixing bug reported by Martin Senger - service type deregistration reported success but actually failed. It now reports failure when appropriate, along with the reason for failure moby-live/Perl/MOBY Central.pm,1.207,1.208 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.207 retrieving revision 1.208 diff -u -r1.207 -r1.208 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/23 23:38:10 1.207 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2005/08/24 15:45:27 1.208 @@ -546,7 +546,7 @@ my ( $success2, $message2, $URI ) = $OntologyServer->deleteObject( term => $class ); - $success2 == 0 && return &_error( $message2, $URI ); + ($success2 == 0) && return &_error( $message2, $URI ); return &_success( $message2, $URI ); } @@ -817,7 +817,7 @@ my ( $success2, $message2, $deleteURI ) = $OntologyServer->deleteServiceType( term => $term ) ; # hopefully this situation will never happen! - (($success == 0)) && return &_error( $message2, $deleteURI ); + (($success2 == 0)) && return &_error( $message2, $deleteURI ); return &_success( "Service type $term deleted.", $deleteURI ); } @@ -972,7 +972,7 @@ my ( $success2, $message2, $URI ) = $OntologyServer->deleteNamespace( term => $term ); - $success2 == 0 && return &_error( $message2, $URI ); + ($success2 == 0) && return &_error( $message2, $URI ); return &_success( "Namespace type $term deregistered successfully.", $URI ); } From senger at pub.open-bio.org Wed Aug 24 19:25:16 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Wed Aug 24 20:08:46 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508242325.j7ONPG6w028392@pub.open-bio.org> senger Wed Aug 24 19:25:16 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/config/templates In directory pub.open-bio.org:/tmp/cvs-serv28374/templates Log Message: Directory /home/repository/moby/moby-live/Java/src/config/templates added to the repository moby-live/Java/src/config/templates - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/config/templates/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/config/templates/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/config/templates/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:26:16 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:09:45 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252326.j7PNQGqK000975@pub.open-bio.org> senger Thu Aug 25 19:26:16 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory pub.open-bio.org:/tmp/cvs-serv957/service Log Message: Directory /home/repository/moby/moby-live/Java/src/main/org/biomoby/service added to the repository moby-live/Java/src/main/org/biomoby/service - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:26:41 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:10:05 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252326.j7PNQfDl001017@pub.open-bio.org> senger Thu Aug 25 19:26:41 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator In directory pub.open-bio.org:/tmp/cvs-serv999/generator Log Message: Directory /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator added to the repository moby-live/Java/src/main/org/biomoby/service/generator - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:27:08 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:10:33 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252327.j7PNR8xQ001069@pub.open-bio.org> senger Thu Aug 25 19:27:08 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/doc-files In directory pub.open-bio.org:/tmp/cvs-serv1051/doc-files Log Message: Directory /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/doc-files added to the repository moby-live/Java/src/main/org/biomoby/service/doc-files - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/doc-files/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/doc-files/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/doc-files/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:29:40 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:13:06 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252329.j7PNTeFS001133@pub.open-bio.org> senger Thu Aug 25 19:29:40 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples In directory pub.open-bio.org:/tmp/cvs-serv1115/samples Log Message: Directory /home/repository/moby/moby-live/Java/src/samples added to the repository moby-live/Java/src/samples - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:30:07 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:13:31 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252330.j7PNU7ef001180@pub.open-bio.org> senger Thu Aug 25 19:30:07 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples-resources In directory pub.open-bio.org:/tmp/cvs-serv1162/samples-resources Log Message: Directory /home/repository/moby/moby-live/Java/src/samples-resources added to the repository moby-live/Java/src/samples-resources - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples-resources/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples-resources/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples-resources/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:41:11 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:24:39 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252341.j7PNfBoD001231@pub.open-bio.org> senger Thu Aug 25 19:41:11 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples/org In directory pub.open-bio.org:/tmp/cvs-serv1213/samples/org Log Message: Directory /home/repository/moby/moby-live/Java/src/samples/org added to the repository moby-live/Java/src/samples/org - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:41:23 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:24:45 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252341.j7PNfNgR001273@pub.open-bio.org> senger Thu Aug 25 19:41:23 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples/org/jmoby In directory pub.open-bio.org:/tmp/cvs-serv1255/samples/org/jmoby Log Message: Directory /home/repository/moby/moby-live/Java/src/samples/org/jmoby added to the repository moby-live/Java/src/samples/org/jmoby - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:41:34 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:25:00 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252341.j7PNfYgD001315@pub.open-bio.org> senger Thu Aug 25 19:41:34 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial In directory pub.open-bio.org:/tmp/cvs-serv1297/samples/org/jmoby/tutorial Log Message: Directory /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial added to the repository moby-live/Java/src/samples/org/jmoby/tutorial - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 19:41:47 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 20:25:11 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508252341.j7PNflFS001357@pub.open-bio.org> senger Thu Aug 25 19:41:47 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/service In directory pub.open-bio.org:/tmp/cvs-serv1339/samples/org/jmoby/tutorial/service Log Message: Directory /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/service added to the repository moby-live/Java/src/samples/org/jmoby/tutorial/service - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/service/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/service/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/service/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 21:26:00 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 22:09:30 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260126.j7Q1Q0Nq001632@pub.open-bio.org> senger Thu Aug 25 21:26:00 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes In directory pub.open-bio.org:/tmp/cvs-serv1614/src/main/org/biomoby/shared/datatypes Log Message: Directory /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes added to the repository moby-live/Java/src/main/org/biomoby/shared/datatypes - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 21:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Aug 25 22:10:27 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260127.j7Q1R4AA001674@pub.open-bio.org> senger Thu Aug 25 21:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser In directory pub.open-bio.org:/tmp/cvs-serv1656/src/main/org/biomoby/shared/parser Log Message: Directory /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser added to the repository moby-live/Java/src/main/org/biomoby/shared/parser - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Thu Aug 25 23:18:09 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 00:01:40 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260318.j7Q3I9Es002107@pub.open-bio.org> senger Thu Aug 25 23:18:09 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files In directory pub.open-bio.org:/tmp/cvs-serv2089/src/main/org/biomoby/shared/parser/doc-files Log Message: Directory /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files added to the repository moby-live/Java/src/main/org/biomoby/shared/parser/doc-files - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:03:37 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 02:47:02 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260603.j7Q63bGt002448@pub.open-bio.org> senger Fri Aug 26 02:03:37 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files In directory pub.open-bio.org:/tmp/cvs-serv2430/src/main/org/biomoby/client/doc-files Log Message: Directory /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files added to the repository moby-live/Java/src/main/org/biomoby/client/doc-files - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:16:34 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R3j6002715@pub.open-bio.org> senger Fri Aug 26 02:27:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Services In directory pub.open-bio.org:/tmp/cvs-serv2547/src/Services Removed Files: _README_ Log Message: moby-live/Java/src/Services _README_,1.1,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/Services/RCS/_README_,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:16:57 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R3wx002678@pub.open-bio.org> senger Fri Aug 26 02:27:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Clients/help In directory pub.open-bio.org:/tmp/cvs-serv2547/src/Clients/help Modified Files: CacheRegistryClient_usage.txt MobyDigest_usage.txt MobyGraphs_usage.txt Added Files: MosesGenerators_usage.txt TestingMobyParser_usage.txt Log Message: moby-live/Java/src/Clients/help MosesGenerators_usage.txt,NONE,1.1 TestingMobyParser_usage.txt,NONE,1.1 CacheRegistryClient_usage.txt,1.1,1.2 MobyDigest_usage.txt,1.1,1.2 MobyGraphs_usage.txt,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Clients/help/CacheRegistryClient_usage.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/Clients/help/CacheRegistryClient_usage.txt 2004/11/14 16:12:50 1.1 +++ /home/repository/moby/moby-live/Java/src/Clients/help/CacheRegistryClient_usage.txt 2005/08/26 06:27:03 1.2 @@ -13,10 +13,10 @@ where specify what Moby registry to connect to -e ia an endpoint of a Moby registry - (default: http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl) + (default: http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl) -uri is a URI defining Moby registry's namespace - (default: http://mobycentral.cbr.nrc.ca/MOBY/Central) + (default: http://mobycentral.icapture.ubc.ca/MOBY/Central) where are: -age ... print date when the cache was created =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Clients/help/MobyDigest_usage.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/Clients/help/MobyDigest_usage.txt 2004/11/14 16:43:49 1.1 +++ /home/repository/moby/moby-live/Java/src/Clients/help/MobyDigest_usage.txt 2005/08/26 06:27:03 1.2 @@ -9,10 +9,10 @@ what cache to use instead): -e ia an endpoint of a Moby registry - (default: http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl) + (default: http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl) -uri is a URI defining Moby registry's namespace - (default: http://mobycentral.cbr.nrc.ca/MOBY/Central) + (default: http://mobycentral.icapture.ubc.ca/MOBY/Central) -cachedir a directory where to cache information from a Moby registry; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Clients/help/MobyGraphs_usage.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/Clients/help/MobyGraphs_usage.txt 2004/10/18 14:35:06 1.5 +++ /home/repository/moby/moby-live/Java/src/Clients/help/MobyGraphs_usage.txt 2005/08/26 06:27:03 1.6 @@ -9,10 +9,10 @@ -e ia an endpoint of a Moby registry - (default: http://mobycentral.cbr.nrc.ca/cgi-bin/MOBY-Central.pl) + (default: http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl) -uri is a URI defining Moby registry's namespace - (default: http://mobycentral.cbr.nrc.ca/MOBY/Central) + (default: http://mobycentral.icapture.ubc.ca/MOBY/Central) -cachedir a directory where to cache information from a Moby registry; From senger at pub.open-bio.org Fri Aug 26 02:27:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:17:39 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R387002605@pub.open-bio.org> senger Fri Aug 26 02:27:02 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv2547/docs Modified Files: ChangeLog Log Message: moby-live/Java/docs ChangeLog,1.35,1.36 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/20 01:58:13 1.35 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/26 06:27:02 1.36 @@ -1,3 +1,21 @@ +2005-08-25 Martin Senger + + * Clean-up build.xml generally, added there new targets for + samples and moses. + + * Changed the remote.dir for build.xml - now we are taking jmoby + jars from biomoby.org/jmoby-jars/jars-archives. + + * Moved sources from src/Services to src/main. Space src/Services + is deprecated. The exaples and tutorials are now in src/samples + that is *not* compiled by default with the src/main compilation. + +2005-08-21 Martin Senger + + * Removed packages org.biomoby.shared.dom and + org.biomoby.shared.dom.wrappers (they were not in use anymore - at + least I hope) + 2005-08-18 Paul Gordon * Completed updated version of MobyRequest that deals with named parameters, @@ -5,6 +23,35 @@ but this invalidates many services, so we relax the rules to allow anonymous parameters if they are unambiguous (i.e., only one of them). +2005-08-17 Martin Senger + + * Refactored package embl.ebi.soap into alltools2.lib (the same + features but used by more projects) + +2005-08-16 Martin Senger + + * Fixed CentralImpl - and empty registry endpoint and namespce are + ignored + + * Fixed CentralDigestCachedImpl to ignore backup files (those + ending with '~') if they appear in the cache + +2005-08-14 Martin Senger + + * Added a static method getString() to + org.biomoby.shared.data.MobyDataDateTime in order to achive the + date/time string conversion features without a need to instantiate + thsi object + + * Moved (and updated) class org.biomoby.shared.MobyObject to + org.biomoby.shared.datatypes.MobyObject + + * Removed interface org.biomoby.shared.MobyNativeService as + obsolete (and not used by anybody, at least I hope :-)) + + * Added method toXMLElement() to + org.biomoby.shared.data.MobyProvisionInfo + 2005-08-07 Paul Gordon * Added asynchronous mode to MobyRequest, so clients get callbacks when From senger at pub.open-bio.org Fri Aug 26 02:27:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:17:41 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R34l002696@pub.open-bio.org> senger Fri Aug 26 02:27:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Clients/notyet In directory pub.open-bio.org:/tmp/cvs-serv2547/src/Clients/notyet Removed Files: CDATATest.java Log Message: moby-live/Java/src/Clients/notyet CDATATest.java,1.1,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/Clients/notyet/RCS/CDATATest.java,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:17:42 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R3Bd002625@pub.open-bio.org> senger Fri Aug 26 02:27:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs/images In directory pub.open-bio.org:/tmp/cvs-serv2547/docs/images Modified Files: ant-snapshot.png Log Message: moby-live/Java/docs/images ant-snapshot.png,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 Binary files /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png 2005/05/19 20:18:54 1.1 and /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png 2005/08/26 06:27:02 1.2 differ rcsdiff: /home/repository/moby/moby-live/Java/docs/images/ant-snapshot.png: diff failed From senger at pub.open-bio.org Fri Aug 26 02:27:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:17:43 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R3qo002647@pub.open-bio.org> senger Fri Aug 26 02:27:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Clients In directory pub.open-bio.org:/tmp/cvs-serv2547/src/Clients Added Files: MosesGenerators.java TestMobyJobs.java TestingMobyParser.java UnregisterByAuthority.java Removed Files: EchoClient.java EchoClient2.java Log Message: moby-live/Java/src/Clients MosesGenerators.java,NONE,1.1 TestMobyJobs.java,NONE,1.1 TestingMobyParser.java,NONE,1.1 UnregisterByAuthority.java,NONE,1.1 EchoClient.java,1.1,NONE EchoClient2.java,1.1,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/Clients/RCS/EchoClient.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/Clients/RCS/EchoClient2.java,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:02 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:17:44 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R2Cq002585@pub.open-bio.org> senger Fri Aug 26 02:27:02 EDT 2005 Update of /home/repository/moby/moby-live/Java/data In directory pub.open-bio.org:/tmp/cvs-serv2547/data Added Files: parser-test-input.xml Log Message: moby-live/Java/data parser-test-input.xml,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:02 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:17:59 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R2xO002570@pub.open-bio.org> senger Fri Aug 26 02:27:02 EDT 2005 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv2547 Modified Files: build.properties.template build.xml Log Message: moby-live/Java build.properties.template,1.3,1.4 build.xml,1.18,1.19 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.properties.template,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/build.properties.template 2004/10/18 14:35:05 1.3 +++ /home/repository/moby/moby-live/Java/build.properties.template 2005/08/26 06:27:02 1.4 @@ -30,3 +30,9 @@ servlet.url.graphs = /graphs/* registry.cache.dir = /tmp/mobycache + +#moses.filter.dt +#moses.service = runFasta +#moses.quiet = yes +#moses.nographs = yes + =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- /home/repository/moby/moby-live/Java/build.xml 2005/08/07 23:41:40 1.18 +++ /home/repository/moby/moby-live/Java/build.xml 2005/08/26 06:27:02 1.19 @@ -9,6 +9,11 @@ + + + + + @@ -22,34 +27,34 @@ - - - - - - - + + + + + + + - + - + - - - - - - - - - + + + + + + + + + @@ -58,21 +63,40 @@ - + + + + + + + + - + + + + + + + + + + + + + - + - - + @@ -195,38 +218,39 @@ - - - - + + + + + + + - - - Missing one or more third-party libraries. - Try to run build.sh or build.bat to fetch them from the net. - - - - - - - - - - - + + + Missing one or more third-party libraries. + Try to run build.sh or build.bat to fetch them from the net. + + + + + + + + @@ -258,8 +282,9 @@ description="Generate API documentation."> - - - -
    Generated: ${TODAY_LONG}]]>
    Submit a bug or feature
    Generated: ${TODAY_LONG}]]>
    + packages="org.biomoby.shared,org.biomoby.shared.*"/> + title="jMoby Client components" + packages="org.biomoby.client,org.biomoby.client.*"/> + title="jMoby Registry components" + packages="org.biomoby.registry,org.biomoby.registry.*"/> - + title="jMoby Components for BioMoby service providers" + packages="org.biomoby.service,org.biomoby.service.*"/> @@ -502,10 +509,10 @@
    - + - - Tomcat Catalina not found. - ----------------------------------- + Tomcat Catalina not found + ========================= Please set environment variable CATALINA_HOME to point to it, or create a file 'build.properties' and put there the line: catalina.home = <location of your CATALINA> @@ -517,10 +524,10 @@ - + - - Tomcat does not seem to be running. - ----------------------------------- + Tomcat does not seem to be running + ================================== I have just checked ${tomcat.host}:${tomcat.port}... You may perhaps consider to start it. @@ -628,8 +635,29 @@ + + + + + + + + + + + + + + + + + + + + + - + - + + + + + @@ -655,10 +687,561 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + No list of service names found. + =============================== + A list can be defined in one of the following ways: + a) Create a property 'services.list' containing + a comma-delimited list of names of services, or + b) For each service, create a property 'service.<service-name> + (replace <service-name> with a real name of service). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <undeployment xmlns="http://xml.apache.org/axis/wsdd/"> + <service name="${service.name}"/> + </undeployment> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Generated: ${TODAY_LONG}]]>
    + + Submit a bug or feature
    + Generated: ${TODAY_LONG}]]>
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Property 'moses.service' is not set. + This means that skeletons for ALL services will be generated. + If this is what you want, press 'y'. Continue? + + + + Build aborted by user. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Generated: ${TODAY_LONG}]]>
    + + Submit a bug or feature
    + Generated: ${TODAY_LONG}]]>
    + +
    +
    + + + + + + + + + +
    From senger at pub.open-bio.org Fri Aug 26 02:35:20 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:18:53 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260635.j7Q6ZKVU003209@pub.open-bio.org> senger Fri Aug 26 02:35:20 EDT 2005 Update of /home/repository/moby/moby-live/Java/generated In directory pub.open-bio.org:/tmp/cvs-serv3191/generated Log Message: Directory /home/repository/moby/moby-live/Java/generated added to the repository moby-live/Java/generated - New directory rcsdiff: /home/repository/moby/moby-live/Java/generated/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/generated/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/generated/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:40:53 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:29:51 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260640.j7Q6erjo003300@pub.open-bio.org> senger Fri Aug 26 02:40:53 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/Clients/help In directory pub.open-bio.org:/tmp/cvs-serv3239/src/Clients/help Added Files: BaseCmdLineClient_usage.txt Log Message: moby-live/Java/src/Clients/help BaseCmdLineClient_usage.txt,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:40:53 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:30:13 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260640.j7Q6ervc003334@pub.open-bio.org> senger Fri Aug 26 02:40:53 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator In directory pub.open-bio.org:/tmp/cvs-serv3239/src/main/org/biomoby/service/generator Added Files: DataTypesGenerator.java Generator.java ServicesGenerator.java Log Message: moby-live/Java/src/main/org/biomoby/service/generator DataTypesGenerator.java,NONE,1.1 Generator.java,NONE,1.1 ServicesGenerator.java,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:40:53 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:30:14 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260640.j7Q6erfS003319@pub.open-bio.org> senger Fri Aug 26 02:40:53 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory pub.open-bio.org:/tmp/cvs-serv3239/src/main/org/biomoby/client Added Files: BaseClient.java BaseCmdLineClient.java MobyServiceLocator.java Log Message: moby-live/Java/src/main/org/biomoby/client BaseClient.java,NONE,1.1 BaseCmdLineClient.java,NONE,1.1 MobyServiceLocator.java,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:40:53 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:51:50 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260640.j7Q6erh9003254@pub.open-bio.org> senger Fri Aug 26 02:40:52 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv3239/docs Added Files: .cvsignore.template Moses.html Log Message: moby-live/Java/docs .cvsignore.template,NONE,1.1 Moses.html,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:40:53 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:51:51 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260640.j7Q6erga003269@pub.open-bio.org> senger Fri Aug 26 02:40:53 EDT 2005 Update of /home/repository/moby/moby-live/Java/generated In directory pub.open-bio.org:/tmp/cvs-serv3239/generated Added Files: .cvsignore.template _README_ Log Message: moby-live/Java/generated .cvsignore.template,NONE,1.1 _README_,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:40:53 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:51:52 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260640.j7Q6erug003285@pub.open-bio.org> senger Fri Aug 26 02:40:53 EDT 2005 Update of /home/repository/moby/moby-live/Java/lib/ant_home/lib In directory pub.open-bio.org:/tmp/cvs-serv3239/lib/ant_home/lib Added Files: ant-contrib.jar Log Message: moby-live/Java/lib/ant_home/lib ant-contrib.jar,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:51:56 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R3kb002750@pub.open-bio.org> senger Fri Aug 26 02:27:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/config In directory pub.open-bio.org:/tmp/cvs-serv2547/src/config Modified Files: run-any-client run-any-client.bat source.me.csh source.me.sh Added Files: run-generator run-generator.bat run-moby-parser run-moby-parser.bat run-service run-service.bat Log Message: moby-live/Java/src/config run-generator,NONE,1.1 run-generator.bat,NONE,1.1 run-moby-parser,NONE,1.1 run-moby-parser.bat,NONE,1.1 run-service,NONE,1.1 run-service.bat,NONE,1.1 run-any-client,1.1,1.2 run-any-client.bat,1.1,1.2 source.me.csh,1.1,1.2 source.me.sh,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/run-any-client,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/config/run-any-client 2004/09/23 00:18:01 1.1 +++ /home/repository/moby/moby-live/Java/src/config/run-any-client 2005/08/26 06:27:03 1.2 @@ -11,7 +11,9 @@ CLASSPATH=${PROJECT_HOME}/build/classes CLASSPATH=${PROJECT_HOME}/build/Clients:$CLASSPATH -CLASSPATH=${PROJECT_HOME}/build/Services:$CLASSPATH +CLASSPATH=${PROJECT_HOME}/build/others/datatypes:$CLASSPATH +CLASSPATH=${PROJECT_HOME}/build/others/skeletons:$CLASSPATH +CLASSPATH=${PROJECT_HOME}/build/others/samples:$CLASSPATH CLASSPATH=`echo ${PROJECT_HOME}/lib/*.jar | tr ' ' ':'`:$CLASSPATH exec java -cp $CLASSPATH "$@" =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/run-any-client.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/config/run-any-client.bat 2004/09/23 00:18:01 1.1 +++ /home/repository/moby/moby-live/Java/src/config/run-any-client.bat 2005/08/26 06:27:03 1.2 @@ -5,6 +5,8 @@ for %%i in (%PROJECT_HOME%\lib\*.jar) do call %PROJECT_HOME%\cp.bat %%i set CP=%PROJECT_HOME%\build\classes;%CP% set CP=%PROJECT_HOME%\build\Clients;%CP% -set CP=%PROJECT_HOME%\build\Services;%CP% +set CP=%PROJECT_HOME%\build\others\datatypes;%CP% +set CP=%PROJECT_HOME%\build\others\skeletons;%CP% +set CP=%PROJECT_HOME%\build\others\samples;%CP% java -classpath %CP% %1 %2 %3 %4 %5 %6 %7 %8 %9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/source.me.csh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/config/source.me.csh 2004/09/23 00:18:01 1.1 +++ /home/repository/moby/moby-live/Java/src/config/source.me.csh 2005/08/26 06:27:03 1.2 @@ -14,5 +14,7 @@ setenv CLASSPATH ${PROJECT_HOME}/build/classes setenv CLASSPATH ${PROJECT_HOME}/build/Clients:${CLASSPATH} -setenv CLASSPATH ${PROJECT_HOME}/build/Services:${CLASSPATH} +setenv CLASSPATH ${PROJECT_HOME}/build/others/datatypes:${CLASSPATH} +setenv CLASSPATH ${PROJECT_HOME}/build/others/skeletons:${CLASSPATH} +setenv CLASSPATH ${PROJECT_HOME}/build/others/samples:${CLASSPATH} setenv CLASSPATH `echo ${PROJECT_HOME}/lib/*.jar | tr ' ' ':'`:${CLASSPATH} =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/source.me.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/config/source.me.sh 2004/09/23 00:18:01 1.1 +++ /home/repository/moby/moby-live/Java/src/config/source.me.sh 2005/08/26 06:27:03 1.2 @@ -14,7 +14,9 @@ CLASSPATH=${PROJECT_HOME}/build/classes CLASSPATH=${PROJECT_HOME}/build/Clients:$CLASSPATH -CLASSPATH=${PROJECT_HOME}/build/Services:$CLASSPATH +CLASSPATH=${PROJECT_HOME}/build/others/datatypes:$CLASSPATH +CLASSPATH=${PROJECT_HOME}/build/others/skeletons:$CLASSPATH +CLASSPATH=${PROJECT_HOME}/build/others/samples:$CLASSPATH CLASSPATH=`echo ${PROJECT_HOME}/lib/*.jar | tr ' ' ':'`:$CLASSPATH export CLASSPATH From senger at pub.open-bio.org Fri Aug 26 02:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:51:58 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R4EJ002769@pub.open-bio.org> senger Fri Aug 26 02:27:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/config/templates In directory pub.open-bio.org:/tmp/cvs-serv2547/src/config/templates Added Files: DataTypeTemplate.java MapDataTypesTemplate.java MembersHASATemplate.java MembersHASTemplate.java MethodsHASATemplate.java MethodsHASA_boolean_Template.java MethodsHASA_string_Template.java MethodsHASTemplate.java MethodsHAS_boolean_Template.java MethodsHAS_string_Template.java ServicePISetTemplate.java ServicePISimpleTemplate.java ServicePOSetTemplate.java ServicePOSimpleTemplate.java ServiceParameterTemplate.java ServiceSkeletonTemplate.java ToStringHASATemplate.java ToStringHASTemplate.java ToXMLHASATemplate.java ToXMLHASTemplate.java Log Message: moby-live/Java/src/config/templates DataTypeTemplate.java,NONE,1.1 MapDataTypesTemplate.java,NONE,1.1 MembersHASATemplate.java,NONE,1.1 MembersHASTemplate.java,NONE,1.1 MethodsHASATemplate.java,NONE,1.1 MethodsHASA_boolean_Template.java,NONE,1.1 MethodsHASA_string_Template.java,NONE,1.1 MethodsHASTemplate.java,NONE,1.1 MethodsHAS_boolean_Template.java,NONE,1.1 MethodsHAS_string_Template.java,NONE,1.1 ServicePISetTemplate.java,NONE,1.1 ServicePISimpleTemplate.java,NONE,1.1 ServicePOSetTemplate.java,NONE,1.1 ServicePOSimpleTemplate.java,NONE,1.1 ServiceParameterTemplate.java,NONE,1.1 ServiceSkeletonTemplate.java,NONE,1.1 ToStringHASATemplate.java,NONE,1.1 ToStringHASTemplate.java,NONE,1.1 ToXMLHASATemplate.java,NONE,1.1 ToXMLHASTemplate.java,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:51:59 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R4bx002790@pub.open-bio.org> senger Fri Aug 26 02:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/embl/ebi/soap In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/embl/ebi/soap Removed Files: AxisUtils.java SOAPToolkit.java SOAPToolkitAxis.java SoapUtils.java package.html Log Message: moby-live/Java/src/main/embl/ebi/soap AxisUtils.java,1.2,NONE SOAPToolkit.java,1.3,NONE SOAPToolkitAxis.java,1.2,NONE SoapUtils.java,1.2,NONE package.html,1.1,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/main/embl/ebi/soap/RCS/AxisUtils.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/embl/ebi/soap/RCS/SOAPToolkit.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/embl/ebi/soap/RCS/SOAPToolkitAxis.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/embl/ebi/soap/RCS/SoapUtils.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/embl/ebi/soap/RCS/package.html,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:03 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R4w7002827@pub.open-bio.org> senger Fri Aug 26 02:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/client Modified Files: CentralDigestCachedImpl.java CentralImpl.java Graphviz.java ServiceConnections.java Added Files: FilterDataTypes.java Log Message: moby-live/Java/src/main/org/biomoby/client FilterDataTypes.java,NONE,1.1 CentralDigestCachedImpl.java,1.4,1.5 CentralImpl.java,1.23,1.24 Graphviz.java,1.8,1.9 ServiceConnections.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java 2005/05/19 15:57:25 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java 2005/08/26 06:27:04 1.5 @@ -36,7 +36,7 @@ * directory, or calls {@link #removeFromCache}).

    * This class can be used also without caching - just instantiate it - * wit 'cacheDir' set to null in the constructor.

    + * with 'cacheDir' set to null in the constructor.

    * * @author Martin Senger * @version $Id$ @@ -238,7 +238,8 @@ // create a file and put into it data to be cached protected void store (File cache, String name, String data) throws MobyException { - File outputFile = new File (cache.getAbsolutePath() + fileSeparator + clean (name)); +// File outputFile = new File (cache.getAbsolutePath() + fileSeparator + clean (name)); + File outputFile = new File (cache.getAbsolutePath() + fileSeparator + name); try { PrintWriter fileout = new PrintWriter (new BufferedOutputStream (new FileOutputStream (outputFile))); @@ -333,9 +334,12 @@ throw new MobyException ("Surprisingly, '" + dataTypesCache.getAbsolutePath() + "' is not a directory. Strange..."); for (int i = 0; i < list.length; i++) { try { + if (list[i].getPath().endsWith ("~")) + continue; // ignore some files v.addElement (createDataTypeFromXML (load (list[i]), "-dummy-")); } catch (NoSuccessException e) { - throw new MobyException (e.getMessage()); + System.err.println ("Ignoring '" + list[i].getPath() + "'. It should not be in the cache directory."); +// throw new MobyException (e.getMessage() + " (" + e.getCulprit() + ")"); } } MobyDataType[] result = new MobyDataType [v.size()]; @@ -359,6 +363,8 @@ if (list == null) throw new MobyException ("Surprisingly, '" + servicesCache.getAbsolutePath() + "' is not a directory. Strange..."); for (int i = 0; i < list.length; i++) { + if (list[i].getPath().endsWith ("~")) + continue; // ignore some files MobyService[] servs = extractServices (load (list[i])); for (int j = 0; j < servs.length; j++) v.addElement (servs[j]); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/08/07 06:30:23 1.23 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/08/26 06:27:04 1.24 @@ -7,24 +7,6 @@ package org.biomoby.client; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; -import java.util.Properties; -import java.util.Vector; - -import org.apache.axis.AxisFault; -import org.apache.axis.client.Call; -import org.apache.axis.client.Service; import org.biomoby.shared.Central; import org.biomoby.shared.MobyData; import org.biomoby.shared.MobyDataType; @@ -40,11 +22,33 @@ import org.biomoby.shared.PendingCurationException; import org.biomoby.shared.Utils; import org.biomoby.shared.MobyResourceRef; + +import embl.ebi.soap.axis.AxisUtils; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.apache.axis.AxisFault; +import org.apache.axis.client.Call; +import org.apache.axis.client.Service; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.Vector; + /** * A default implementation of the * interface {@link org.biomoby.shared.Central Central} @@ -130,9 +134,9 @@ public CentralImpl (String endpoint, String namespace) throws MobyException { - if (endpoint == null) + if (endpoint == null || "".equals (endpoint.trim())) endpoint = DEFAULT_ENDPOINT; - if (namespace == null) + if (namespace == null || "".equals (namespace.trim())) namespace = DEFAULT_NAMESPACE; try { @@ -193,8 +197,9 @@ } } catch (AxisFault e) { - throw new MobyException (Utils.formatFault (e, endpoint.toString(), - (call == null ? null : call.getOperationName()))); + throw new MobyException + (AxisUtils.formatFault (e, endpoint.toString(), + (call == null ? null : call.getOperationName()))); } catch (Exception e) { throw new MobyException (e.toString()); // e.printStackTrace(); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/Graphviz.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/Graphviz.java 2005/07/19 12:39:59 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/Graphviz.java 2005/08/26 06:27:04 1.9 @@ -34,6 +34,29 @@ */ public static final String PROP_RANKDIR = "rankdir"; + /** Property name. It contains a name of an element that should + be highlighted in the resulting graph. + */ + public static final String PROP_HIGHLIGHT = "highlight"; + + /** Property name. It contains a name of a color that should be + used to highlight an element (see {@link + #PROP_HIGHLIGHT}. Default is "cyan2". + */ + public static final String PROP_HIGHLIGHT_COLOR = "highlightcolor"; + + /** Property name. It indicates that the graph should create URLs + for graph nodes (except the highlighted one - see @{link + #PROP_HIGHLIGHT}). The default URL is taken from this + property. If this property exists but has an empty value, the + URL for individual nodes are still going to be created, but + not the deafult one. The URLs for individual nodes are taken + from the "comment" field of the data objects for whom are + nodes created. No URL is created for a node where the comment + field is empty. + */ + public static final String PROP_IMAGEMAP = "imagemap"; + /************************************************************************* * Creates a graph connecting Moby services as defined in a set of * the graph 'edges'.

    @@ -255,6 +278,43 @@ buf.append ("digraph MobyDataTypes {\n"); buf.append ("\trankdir=" + props.getProperty (PROP_RANKDIR, "LR") + ";\n"); buf.append ("\tedge [dir=back,arrowtail=empty];\n"); + + String highlighted = props.getProperty (PROP_HIGHLIGHT); + if (highlighted != null) { + for (int i = 0; i < dataTypes.length; i++) { + if (highlighted.equals (dataTypes[i].getName())) { + buf.append ("\t"); + buf.append (quoteIt (trName (Utils.pureName (highlighted)))); + buf.append (" [fillcolor="); + buf.append (quoteIt (props.getProperty (PROP_HIGHLIGHT_COLOR, "cyan2"))); + buf.append (",style=filled];\n"); + break; + } + } + } + + String defaultURL = props.getProperty (PROP_IMAGEMAP); + if (defaultURL != null) { + if (! "".equals (defaultURL)) { + buf.append ("\tURL=\""); + buf.append (defaultURL); + buf.append ("\";\n"); + } + for (int i = 0; i < dataTypes.length; i++) { + String name = dataTypes[i].getName(); + if (name.equals (highlighted)) + continue; // no hyperlink for the highlighted one + String hyperlink = dataTypes[i].getComment(); + if (hyperlink != null && ! "".equals (hyperlink.trim())) { + buf.append ("\t"); + buf.append (quoteIt (trName (Utils.pureName (name)))); + buf.append (" [URL=\""); + buf.append (hyperlink); + buf.append ("\"];\n"); + } + } + } + for (int d = 0; d < dataTypes.length; d++) { MobyDataType type = dataTypes[d]; String name = Utils.pureName (type.getName()); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServiceConnections.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/ServiceConnections.java 2005/07/19 12:39:59 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServiceConnections.java 2005/08/26 06:27:04 1.6 @@ -41,7 +41,7 @@ /************************************************************************* - * Make te data types better searchable. This is a public method + * Make the data types better searchable. This is a public method * because for optimalization purposes it is often better to make * the hashtable only once. * From senger at pub.open-bio.org Fri Aug 26 02:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:05 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R4Ug002842@pub.open-bio.org> senger Fri Aug 26 02:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/client/doc-files Added Files: client-processing.dot client-processing.png Log Message: moby-live/Java/src/main/org/biomoby/client/doc-files client-processing.dot,NONE,1.1 client-processing.png,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:07 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R49Y002860@pub.open-bio.org> senger Fri Aug 26 02:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/service Added Files: BaseService.java package.html Log Message: moby-live/Java/src/main/org/biomoby/service BaseService.java,NONE,1.1 package.html,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:13 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R43X002876@pub.open-bio.org> senger Fri Aug 26 02:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/doc-files In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/service/doc-files Added Files: service-inheritance.dot service-inheritance.png Log Message: moby-live/Java/src/main/org/biomoby/service/doc-files service-inheritance.dot,NONE,1.1 service-inheritance.png,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:04 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:15 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R4HI002922@pub.open-bio.org> senger Fri Aug 26 02:27:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/shared Modified Files: MobyData.java MobyDataType.java MobyResourceRef.java MobyService.java Utils.java package.html Removed Files: MobyNativeService.java MobyObject.java Log Message: moby-live/Java/src/main/org/biomoby/shared MobyData.java,1.3,1.4 MobyDataType.java,1.6,1.7 MobyResourceRef.java,1.1,1.2 MobyService.java,1.5,1.6 Utils.java,1.5,1.6 package.html,1.2,1.3 MobyNativeService.java,1.2,NONE MobyObject.java,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyData.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyData.java 2005/04/07 16:37:02 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyData.java 2005/08/26 06:27:04 1.4 @@ -56,7 +56,7 @@ } /************************************************************************** - * Must be overwritten byte a subclass. + * Must be overwritten by a subclass. *************************************************************************/ abstract public String toXML(); abstract public boolean isPrimary(); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2005/04/07 16:37:02 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2005/08/26 06:27:04 1.7 @@ -32,6 +32,7 @@ protected String[] parentNames = new String[] { }; protected MobyRelationship[] children = new MobyRelationship[] { }; protected String id = null; + protected String comment = null; /************************************************************************** * Default constructor. @@ -268,4 +269,21 @@ return Utils.format (this, indent); } + /** + * Return a comment that is attached to this instance. A comment + * can be anything and it is not meant to be used by end-users + * (that's why it is not included in the {@link #toString} + * method). It is for developers doing various tricks with these + * instances.

    + */ + public String getComment() { + return comment; + } + /** + * @see #getComment + */ + public void setComment (String value) { + comment = (value == null ? "" : value); + } + } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyResourceRef.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyResourceRef.java 2005/08/07 06:29:58 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyResourceRef.java 2005/08/26 06:27:04 1.2 @@ -30,11 +30,11 @@ * Normal constructor.

    * * @param resourceName is an ontology name (must be one of these: - * {@link Central.SERVICE_TYPES_RESOURCE_NAME}, {@link - * Central.DATA_TYPES_RESOURCE_NAME}, {@link - * Central.NAMESPACES_RESOURCE_NAME}, {@link - * Central.SERVICE_INSTANCES_RESOURCE_NAME}, {@link - * Central.FULL_RESOURCE_NAME}) + * {@link Central#SERVICE_TYPES_RESOURCE_NAME}, {@link + * Central#DATA_TYPES_RESOURCE_NAME}, {@link + * Central#NAMESPACES_RESOURCE_NAME}, {@link + * Central#SERVICE_INSTANCES_RESOURCE_NAME}, {@link + * Central#FULL_RESOURCE_NAME}) * * @param location where this resource can be fetched from * =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.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/shared/MobyService.java 2005/04/07 16:37:02 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java 2005/08/26 06:27:04 1.6 @@ -24,6 +24,18 @@ public class MobyService { + /** + * A dummy name used for MobyService instances that do not have + * (yet) a real name. + */ + static public final String DUMMY_NAME = "_dummy_"; + + /** + * An immutable string representing URI (namespace) of all Biomoby + * services. + */ + static public final String BIOMOBY_SERVICE_URI = "http://biomoby.org/"; + protected String name; protected String category = "moby"; protected String authority = ""; @@ -46,7 +58,7 @@ * Default constructor. *************************************************************************/ public MobyService() { - this ("_dummy_"); + this (DUMMY_NAME); } /************************************************************************** @@ -312,4 +324,8 @@ return new String (buf); } + public String toShortString() { + return name + " (" + authority + ")"; + } + } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Utils.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/shared/Utils.java 2005/04/07 16:37:02 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Utils.java 2005/08/26 06:27:04 1.6 @@ -7,9 +7,19 @@ package org.biomoby.shared; +import org.apache.axis.AxisFault; import javax.xml.namespace.QName; -import org.apache.axis.AxisFault; +import java.util.HashSet; +import java.io.PrintWriter; +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.File; +import java.io.IOException; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.InputStream; + /** * This is a set of several utility methods which may be useful for @@ -22,49 +32,6 @@ public abstract class Utils { - /************************************************************************* - * Format an exception 'e' and return it back. - *

    - * @param e an exception to e formatted - * @return a formatted exception - *************************************************************************/ - public static String formatFault (AxisFault e) { - return formatFault (e, null, null); - } - - /************************************************************************* - * Return a nicely formatted exception 'e' with few additional details - * taken from 'endpoint' (where is the called service) and 'method' - * (what method caused this exception). - *

    - * @param e an exception to e formatted - * @param endpoint of a service that caused the exception - * @param method that caused the exception - * @return a formatted exception - *************************************************************************/ - public static String formatFault (AxisFault e, - String endpoint, QName method) { - StringBuffer buf = new StringBuffer(); - buf.append ("===ERROR===\n"); - buf.append ("Fault details:\n"); - org.w3c.dom.Element[] details = e.getFaultDetails(); - for (int i = 0; i < details.length; i++) { - String s = replace (replace (details[i].toString(), "<", "<"), ">", ">"); - buf.append (s + "\n"); - } - buf.append ("Fault string: " + e.getFaultString() + "\n"); - buf.append ("Fault code: " + e.getFaultCode() + "\n"); - buf.append ("Fault actor: " + e.getFaultActor() + "\n"); - if (endpoint != null || method != null) - buf.append ("When calling:\n"); - if (endpoint != null) - buf.append ("\t" + endpoint + "\n"); - if (method != null) - buf.append ("\t" + method + "\n"); - buf.append ("===========\n"); - return new String (buf); - } - /** * In 'string', replace all occurrences of * 'from' by 'to' and return the resulting string. @@ -110,6 +77,38 @@ } /************************************************************************* + * Create a file and fill it with given contents.

    + * + * @param file to be created + * @param contents what to put in the created file + * @throws MobyException if something goes wrong + *************************************************************************/ + public static void createFile (File file, String contents) + throws MobyException { + createFile (file, new StringBuffer (contents)); + } + + /************************************************************************* + * Create a file and fill it with given contents.

    + * + * @param file to be created + * @param contents what to put in the created file + * @throws MobyException if something goes wrong + *************************************************************************/ + public static void createFile (File file, StringBuffer contents) + throws MobyException { + try { + PrintWriter fileout = new PrintWriter + (new BufferedWriter (new FileWriter (file))); + fileout.print (contents); + fileout.close(); + } catch (IOException e) { + throw new MobyException + ("Cannot create file '" + file.getAbsolutePath() + "'. " + e.toString()); + } + } + + /************************************************************************* * Return just the last part of the LSID identifier. An example of * an LSID identifier as used by and returned from the Moby * registry is urn:lsid:biomoby.org:objectclass:object. @@ -127,5 +126,229 @@ return lsid.substring (pos + 1); } + /************************************************************************* + * Find the resource with the given 'filename', read it and return + * it. A resource is some data (images, audio, text, etc) that can be + * accessed by class code in a way that is independent of the location + * of the code, typicallt such resource file sits anywhere on the CLASSPATH.

    + * + * @param filename of a resource is a '/'-separated path name that + * identifies the resource + * @param resourceOwner is any object whose class loader is used + * to find and get the resource; typically one would put here + * "this" when calling this method + * @return contents of the resource, or null if the resource could + * not be found + * @throws MobyException if resource was found but an error + * occured during its reading (IO problem, memory problem etc.) + *************************************************************************/ + public static String readResource (String filename, Object resourceOwner) + throws MobyException { + + InputStream ins = + resourceOwner.getClass().getClassLoader().getResourceAsStream + (filename); + if (ins != null) { + BufferedReader data = null; + try { + StringBuffer contents = new StringBuffer(); + data = new BufferedReader (new InputStreamReader (ins)); + String line; + while ((line = data.readLine()) != null) { + contents.append (line); + contents.append ("\n"); + } + return new String (contents); + } catch (IOException e) { + throw new MobyException ("Problem when reading resource '" + filename + + "'. " + e.toString()); + } catch (Error e) { // be prepare for "out-of-memory" error + throw new MobyException ("Problem when reading resource '" + filename + + "'. " + e.toString(), e); + } finally { + try { + if (data != null) + data.close(); + } catch (IOException e) { + } + } + } + return null; + } + + /************************************************************************* + * Return just the last part of a Java class name (after the last + * dot). It is useful for displaying purposes (and when data do + * not have article names).

    + * + * @param className whose last part is being looked for + * @return the last part of 'className', or the whole 'className' if it does + * not contain any dots + *************************************************************************/ + public static String simpleClassName (String className) { + int pos = className.lastIndexOf ("."); + int len = className.length(); + if (pos == -1) return className; + if (pos == len-1) return className.substring (0, pos); + return className.substring (pos + 1); + } + + /********************************************************************* + * Check or create an article name. Biomoby uses term "article + * name" for naming Biomoby objects by context where they + * appear. For example, article name must be used for Biomoby + * objects that are children (members) of other Biomoby objects.

    + * + * This method checks if the given 'articleName' is not empty - + * and if it is then it replaces it with the given 'className' + * (each Biomoby object always has a class name).

    + * + * It also trims the article name (removes starting and ending + * whitespaces).

    + * + * @param articleName will be checked, or created if it is empty + * @param className will be used to create an article name (if + * necessary) + * @return original 'articleName' or a new (created) one + ********************************************************************/ + static public String checkOrCreateArticleName (String articleName, + String className) { + + // triming whitespaces + if (articleName.length() != articleName.trim().length()) + articleName = articleName.trim(); + + // return back the original article name (if it was good) + if (articleName != null && ! "".equals (articleName.trim())) + return articleName; + + // if there is no article name, take the last part of the + // class name + return Utils.simpleClassName (className); + } + + /************************************************************************* + * Make sure that an article name does not collide with the member + * names in the top-level MobyObject. The members in question are + * 'id', 'name', 'namespace' and 'value'. This does not mean that + * Biomoby data types are not allowed to have such article names, + * but that Java code generator must generate slightly different + * names for its methods in these cases.

    + * + * I must admit that this replacement is not full-proof: if a data + * type will have both article names 'value' and 'the_value' then + * this arrangement breaks...

    + * + * This method is used at least from two places now (an XML Moby + * Parser and a MoSeS code generator) - that's why it ended up + * here in general utilities.

    + * + * @param value will be checked (already expected not to be empty) + * @return the same 'value' if nothing wrong with it was found, or + * a new string resembling the 'value' but having some characters + * replaced + *************************************************************************/ + public static String mobyEscape (String value) { + if ( "value".equals (value) || + "name".equals (value) || + "namespace".equals (value) || + "id".equals (value) ) + return "the_" + value; + else + return value; + } + + /************************************************************************* + * Make 'value' a valid Java identifier by trimming it and by + * replacing "unwanted" characters by underscores.

    + * + * @param value will be checked + * @return the same 'value' if nothing wrong with it was found, or + * a new string resembling the 'value' but having some characters + * replaced + *************************************************************************/ + public static String javaEscape (String value) { + if (value == null || value.trim().equals ("")) + return "_"; + boolean found = false; // if it becomes true we need to return a new string + char[] s = value.trim().toCharArray(); + if (s.length != value.length()) + found = true; // can happen because of trimming + if (! Character.isJavaIdentifierStart (s[0])) { + s[0] = '_'; + found = true; + } + for (int i = 1; i < s.length ; i++ ) { + if (! Character.isJavaIdentifierPart (s[i])) { + s[i] = '_'; + found = true; + } + } + if (javaReserved.contains (value)) { + value = "_" + value; + found = true; + } + return (found ? new String (s) : value); + } + + /************************************************************************* + * + *************************************************************************/ + protected static HashSet javaReserved = new HashSet(); + static { + javaReserved.add ("abstract"); + javaReserved.add ("assert"); + javaReserved.add ("boolean"); + javaReserved.add ("break"); + javaReserved.add ("byte"); + javaReserved.add ("case"); + javaReserved.add ("catch"); + javaReserved.add ("char"); + javaReserved.add ("class"); + javaReserved.add ("const"); + javaReserved.add ("continue"); + javaReserved.add ("default"); + javaReserved.add ("do"); + javaReserved.add ("double"); + javaReserved.add ("else"); + javaReserved.add ("enum"); + javaReserved.add ("extends"); + javaReserved.add ("false"); + javaReserved.add ("final"); + javaReserved.add ("finally"); + javaReserved.add ("float"); + javaReserved.add ("for"); + javaReserved.add ("goto"); + javaReserved.add ("if"); + javaReserved.add ("implements"); + javaReserved.add ("import"); + javaReserved.add ("instanceof"); + javaReserved.add ("int"); + javaReserved.add ("interface"); + javaReserved.add ("long"); + javaReserved.add ("native"); + javaReserved.add ("new"); + javaReserved.add ("null"); + javaReserved.add ("package"); + javaReserved.add ("private"); + javaReserved.add ("protected"); + javaReserved.add ("public"); + javaReserved.add ("return"); + javaReserved.add ("short"); + javaReserved.add ("static"); + javaReserved.add ("strictfp"); + javaReserved.add ("super"); + javaReserved.add ("switch"); + javaReserved.add ("synchronized"); + javaReserved.add ("this"); + javaReserved.add ("throw"); + javaReserved.add ("throws"); + javaReserved.add ("transient"); + javaReserved.add ("true"); + javaReserved.add ("try"); + javaReserved.add ("void"); + javaReserved.add ("volatile"); + javaReserved.add ("while"); + } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/package.html,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/shared/package.html 2005/05/19 15:57:26 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/package.html 2005/08/26 06:27:04 1.3 @@ -18,7 +18,50 @@ cornerstone piece is the interface {@link org.biomoby.shared.Central} that defines how to access Moby registry without any knowledge of the used transport protocol (SOAP, XML, etc.). This interface uses several -container classes representing pieces of the Moby mosaic. +container classes representing pieces of the Moby mosaic.

    +Talking about a mosaic, it looks sometimes confusing what data +containers we have here (and in sub-packages). Let's try to briefly +explain them: + +

      + +
    • The data containers located directly here (in +org.biomoby.shared package, for example {@link +org.biomoby.shared.MobyService MobyService}) were designed to carry +information to and from Biomoby registries. Their names are a bit +misnomer because they can be easily confused with similar data +containers carrying real data to the Biomoby service +providers.

      + +

    • The {@link org.biomoby.shared.data} package deals with data +containers travelling between clients and Biomoby service +providers. They were designed by Paul Gordon and their usage is best +explain in the Simple client document. The main idea is that the +same data types are used for all services because they are designed +as general as possible (its is a loosely-typed +concept).

      + +

    • The {@link org.biomoby.shared.datatypes} is similar to the +previous one because it also contains containers for data exchange +between the clients and Biomoby service providers. It was created by +Martin Senger and its primary purpose is to be a part of code +generators (see details in the Moses document. The package here has only primitive +data types, but a data type generator is able to fill-in hundreds of +data types from Biomoby registries - so developers can use +strongly-typed approach.

      + +

    • The package {@link org.biomoby.shared.parser} is closely +related to the previous one because it provides Biomoby envelopes for +data types defined in {@link org.biomoby.shared.datatypes}. It has +classes for Biomoby Simples and Collections - where inside can sit +containers from the previous package. Additionally, it has a Biomoby +parser that can fill these containers from an XML.

      + +

    rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/RCS/MobyNativeService.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/RCS/MobyObject.java,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:19 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5dI002955@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/shared/data Modified Files: MobyDataDateTime.java MobyDataXref.java MobyProvisionInfo.java Log Message: moby-live/Java/src/main/org/biomoby/shared/data MobyDataDateTime.java,1.3,1.4 MobyDataXref.java,1.2,1.3 MobyProvisionInfo.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java 2005/07/22 05:11:54 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java 2005/08/26 06:27:04 1.4 @@ -212,11 +212,22 @@ } /** - * Return an ISO 8601 string representing the date/time represented by this Calendar. - * ISO 8601 date manipulation in Java 1.2 based on code by Simon Brooke - * Does not yet deal with fractions of seconds. + * Return an ISO 8601 string representing the date/time + * represented by this Calendar. */ public String toString(){ + return getString (value); + } + + /************************************************************************** + * A utility (static) method converting a GregorianCalendar object + * to an ISO 8601 string. ISO 8601 date manipulation in Java 1.2 + * based on code by Simon Brooke + * <simon@jasmine.org.uk>. Does not yet deal with fractions + * of seconds. + *************************************************************************/ + public static String getString (GregorianCalendar value) { + String timef = "'T'hh:mm:ss"; String datef = "yyyy-MM-dd"; String bothf = "yyyy-MM-dd'T'hh:mm:ss"; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.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/shared/data/MobyDataXref.java 2005/05/19 15:57:26 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java 2005/08/26 06:27:04 1.3 @@ -100,7 +100,7 @@ } else{ throw new IllegalArgumentException("Evidence code to be set (" + - code + " was not a valid GO code"); + code + " is not a valid GO code)."); } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java 2005/05/12 05:17:58 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java 2005/08/26 06:27:04 1.2 @@ -1,8 +1,15 @@ package org.biomoby.shared.data; +import org.biomoby.shared.parser.MobyTags; +import org.biomoby.shared.parser.MobyPackage; + +import org.jdom.Element; +import org.jdom.output.XMLOutputter; +import org.jdom.output.Format; + /** - * Class to hold data corresponginf to the MOBY PIB. + * Class to hold data corresponging to the MOBY PIB. */ public class MobyProvisionInfo{ @@ -76,46 +83,113 @@ return serviceComment; } - /** - * For escaping XML meta-characters from attribute strings, - * namely ampersand, double quote, and greater-than - */ - private String escape(String text){ - if(text == null){ - return ""; - } - text = text.replaceAll("&(?!(amp|#x\\d+);)", "&"); - text = text.replaceAll("<", "<"); - return text.replaceAll("\"", """); - } +// /** +// * For escaping XML meta-characters from attribute strings, +// * namely ampersand, double quote, and greater-than +// */ +// private String escape(String text){ +// if(text == null){ +// return ""; +// } +// text = text.replaceAll("&(?!(amp|#x\\d+);)", "&"); +// text = text.replaceAll("<", "<"); +// return text.replaceAll("\"", """); +// } /** - * This method formats the available information into an XML format - * suitable for inclusion in a MOBY Object. If all fields are null, - * an empty string is returned (the MOBY-S API specifies that a ProvisionInformation - * block must contain at least one child tag). + * This method formats the available information into an XML + * format suitable for inclusion in a MOBY Object. */ public String toXML(){ - StringBuffer xml = new StringBuffer(); - if(softwareName != null || softwareVersion != null || softwareComment != null){ - xml.append("\n"); - } - if(dbName != null || dbVersion != null || dbComment != null){ - xml.append("\n"); - } - if(serviceComment != null){ - xml.append(""+escape(serviceComment)+""); - } + XMLOutputter xo = new XMLOutputter(); + xo.setFormat(Format.getPrettyFormat()); + Element provision = toXMLElement(); + + // This is a bad hack - but I do not know how to remove + // xmlns=... from this Element properly... + return xo.outputString (provision).replaceAll + (" xmlns:" + provision.getNamespace().getPrefix() + + "=\"" + provision.getNamespace().getURI() + "\"", ""); + } + +// /** +// * This method formats the available information into an XML format +// * suitable for inclusion in a MOBY Object. If all fields are null, +// * an empty string is returned (the MOBY-S API specifies that a ProvisionInformation +// * block must contain at least one child tag). +// */ + +// StringBuffer xml = new StringBuffer(); +// if(softwareName != null || softwareVersion != null || softwareComment != null){ +// xml.append("\n"); +// } +// if(dbName != null || dbVersion != null || dbComment != null){ +// xml.append("\n"); +// } +// if(serviceComment != null){ +// xml.append(""+escape(serviceComment)+""); +// } - if(xml.length() == 0){ - // Empty info, return empty string - return ""; +// if(xml.length() == 0){ +// // Empty info, return empty string +// return ""; +// } + +// return "\n"+xml.toString()+"\n"; + + /************************************************************************** + * + *************************************************************************/ + public Element toXMLElement() { + Element provision = MobyPackage.getXMLElement (MobyTags.PROVISIONINFORMATION); + + Element software = MobyPackage.getXMLElement (MobyTags.SERVICESOFTWARE); + MobyPackage.setXMLAttribute (software, MobyTags.SOFTWARENAME, softwareName); + MobyPackage.setXMLAttribute (software, MobyTags.SOFTWAREVERSION, softwareVersion); + MobyPackage.setXMLAttribute (software, MobyTags.SOFTWARECOMMENT, softwareComment); + provision.addContent (software); + + Element db = MobyPackage.getXMLElement (MobyTags.SERVICEDATABASE); + MobyPackage.setXMLAttribute (db, MobyTags.DATABASENAME, dbName); + MobyPackage.setXMLAttribute (db, MobyTags.DATABASEVERSION, dbVersion); + MobyPackage.setXMLAttribute (db, MobyTags.DATABASECOMMENT, dbComment); + provision.addContent (db); + + if (serviceComment != null) { + Element comment = MobyPackage.getXMLElement (MobyTags.SERVICECOMMENT); + comment.setText (serviceComment); + provision.addContent (comment); } - return "\n"+xml.toString()+"\n"; + return provision; + } + + /************************************************************************** + * + *************************************************************************/ + public String toString() { + StringBuffer buf = new StringBuffer(); + buf.append ("Provision information:\n"); + if (softwareName != null) buf.append (" Software name: " + softwareName + "\n"); + if (softwareVersion != null) buf.append (" Software version: " + softwareVersion + "\n"); + if (softwareComment != null) buf.append (" Software comment: " + softwareComment + "\n"); + if (dbName != null) buf.append (" Database name: " + dbName + "\n"); + if (dbVersion != null) buf.append (" Database version: " + dbVersion + "\n"); + if (dbComment != null) buf.append (" Database comment: " + dbComment + "\n"); + if (serviceComment != null) buf.append (" Service comment: " + serviceComment + "\n"); + return new String (buf); + } + + /************************************************************************** + * + *************************************************************************/ + public String format (int indent) { + return org.biomoby.shared.Utils.format (this, indent); } + + } From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:21 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5R5002970@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/shared/datatypes Added Files: MapDataTypesIfc.java MapPrimitiveDataTypes.java MobyBoolean.java MobyDateTime.java MobyFloat.java MobyInteger.java MobyObject.java MobyString.java MobyXref.java package.html Log Message: moby-live/Java/src/main/org/biomoby/shared/datatypes MapDataTypesIfc.java,NONE,1.1 MapPrimitiveDataTypes.java,NONE,1.1 MobyBoolean.java,NONE,1.1 MobyDateTime.java,NONE,1.1 MobyFloat.java,NONE,1.1 MobyInteger.java,NONE,1.1 MobyObject.java,NONE,1.1 MobyString.java,NONE,1.1 MobyXref.java,NONE,1.1 package.html,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:22 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5Es002989@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/dom In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/shared/dom Removed Files: ParserWrapper.java Log Message: moby-live/Java/src/main/org/biomoby/shared/dom ParserWrapper.java,1.1,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/dom/RCS/ParserWrapper.java,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:26 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5TU003005@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/dom/wrappers In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/shared/dom/wrappers Removed Files: Xerces.java Log Message: moby-live/Java/src/main/org/biomoby/shared/dom/wrappers Xerces.java,1.3,NONE rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/dom/wrappers/RCS/Xerces.java,v: No such file or directory From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:28 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5aB003042@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/shared/parser/doc-files Added Files: data-containers.dot data-containers.png Log Message: moby-live/Java/src/main/org/biomoby/shared/parser/doc-files data-containers.dot,NONE,1.1 data-containers.png,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:29 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5BI003059@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/service In directory pub.open-bio.org:/tmp/cvs-serv2547/src/samples/org/jmoby/tutorial/service Added Files: HelloBiomobyWorldImpl.java MabuhayImpl.java Log Message: moby-live/Java/src/samples/org/jmoby/tutorial/service HelloBiomobyWorldImpl.java,NONE,1.1 MabuhayImpl.java,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:34 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5HB003024@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/shared/parser Added Files: MobyCollection.java MobyDataElement.java MobyJob.java MobyPackage.java MobyParameter.java MobyParser.java MobySimple.java MobyTags.java package.html Log Message: moby-live/Java/src/main/org/biomoby/shared/parser MobyCollection.java,NONE,1.1 MobyDataElement.java,NONE,1.1 MobyJob.java,NONE,1.1 MobyPackage.java,NONE,1.1 MobyParameter.java,NONE,1.1 MobyParser.java,NONE,1.1 MobySimple.java,NONE,1.1 MobyTags.java,NONE,1.1 package.html,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:05 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:36 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R5HC003076@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples-resources In directory pub.open-bio.org:/tmp/cvs-serv2547/src/samples-resources Added Files: mabuhay.file Log Message: moby-live/Java/src/samples-resources mabuhay.file,NONE,1.1 From senger at pub.open-bio.org Fri Aug 26 02:27:06 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Fri Aug 26 03:52:38 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508260627.j7Q6R6GX003098@pub.open-bio.org> senger Fri Aug 26 02:27:05 EDT 2005 Update of /home/repository/moby/moby-live/Java/xmls In directory pub.open-bio.org:/tmp/cvs-serv2547/xmls Modified Files: libraries.xml Log Message: moby-live/Java/xmls libraries.xml,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/libraries.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/xmls/libraries.xml 2005/07/19 12:39:59 1.2 +++ /home/repository/moby/moby-live/Java/xmls/libraries.xml 2005/08/26 06:27:05 1.3 @@ -8,10 +8,11 @@ - + + @@ -48,6 +49,7 @@ + @@ -97,6 +99,7 @@ + From mwilkinson at pub.open-bio.org Fri Aug 26 16:30:41 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Fri Aug 26 17:14:03 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508262030.j7QKUfkY007800@pub.open-bio.org> mwilkinson Fri Aug 26 16:30:41 EDT 2005 Update of /home/repository/moby/moby-live/Database In directory pub.open-bio.org:/tmp/cvs-serv7780 Modified Files: Update_DB_085_to_086.pl Log Message: tweak of database migration script moby-live/Database Update_DB_085_to_086.pl,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Database/Update_DB_085_to_086.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Database/Update_DB_085_to_086.pl 2005/08/07 10:01:39 1.1 +++ /home/repository/moby/moby-live/Database/Update_DB_085_to_086.pl 2005/08/26 20:30:41 1.2 @@ -107,7 +107,7 @@ $dbh->do("update object set is_primitive='1' where object_id='$id'"); } -my @deprecated_ids; # will hold a list of the database ids of all deprecated types +my %deprecated_to_new; # will hold a map of all deprecated ids to all new ids; my $sth_primitives = $dbh->prepare("select object_id, object_type from object where is_primitive = '1'"); $sth_primitives->execute(); @@ -117,7 +117,6 @@ $sth2_inherits_from_primitive->execute($primitive_id); while (my ($O1id) = $sth2_inherits_from_primitive->fetchrow_array){ next unless ($O1id); - push @deprecated_ids, $O1id; my $sth3_inherited_object_details = $dbh->prepare("select object_type, object_lsid, description, authority, contact_email from object where object_id=?"); $sth3_inherited_object_details->execute($O1id); my ($type, $lsid, $description, $authority, $contact_email) = $sth3_inherited_object_details->fetchrow_array(); @@ -144,6 +143,7 @@ next; } my $new_object_id = $dbh->{'mysql_insertid'}; + $deprecated_to_new{$O1id} = $new_object_id; # map the old id to the new id my $sth_insertnew_relationships = $dbh->prepare("insert into object_term2term(relationship_type, object1_id, object2_id, object2_articlename) values (?,?,?,?)"); $sth_insertnew_relationships->execute($isa, $new_object_id, $OBJECT_ID, ""); # insert isa Object $sth_insertnew_relationships->execute($hasa, $new_object_id, $primitive_id, $type); #insert hasa String(plain_text) ...for example @@ -154,20 +154,49 @@ my $sth_insertnew = $dbh->prepare("insert into object (object_type, object_lsid, description, authority, contact_email, is_primitive) values (?,?,?,?,?,?)"); $sth_insertnew->execute("ISO_DateTime", "urn:lsid:biomoby.org:objectclass:ISO_DateTime", "A Date/Time in ISO 8601 format", "biomoby.org", 'markw@illuminae.com', "1"); -print "\n\nAll updates were apparently successful!\n\n"; -foreach (@deprecated_ids){ - my $sth_downstream_from_deprecated = $dbh->prepare("select object1_id from object_term2term where object2_id = ?"); +foreach (keys(%deprecated_to_new)){ + my $new_id = $deprecated_to_new{$_}; + my $sth_downstream_from_deprecated = $dbh->prepare("select assertion_id, object1_id from object_term2term where relationship_type='urn:lsid:biomoby.org:objectrelation:isa' and object2_id = ?"); $sth_downstream_from_deprecated->execute($_); - my ($O1id) = $sth_downstream_from_deprecated->fetchrow_array; + my ($relationship_id, $O1id) = $sth_downstream_from_deprecated->fetchrow_array; next unless ($O1id); my $sth3_inherited_object_details = $dbh->prepare("select object_type, object_lsid, description, authority, contact_email from object where object_id=?"); $sth3_inherited_object_details->execute($O1id); my ($type, $lsid, $description, $authority, $contact_email) = $sth3_inherited_object_details->fetchrow_array(); next unless ($type); open OUT, ">>UPDATE_ERROR_LOG"; - print OUT "Object $type and its children are now broken\n"; + print OUT "Object $type and its children are now broken through ISA linkage\n"; close OUT; print " Object $type in your ontology is now broken as it inherits from a deprecated object!\n"; + + $sth_downstream_from_deprecated = $dbh->prepare("select assertion_id, object1_id from object_term2term where relationship_type='urn:lsid:biomoby.org:objectrelation:hasa' and object2_id = ?"); + $sth_downstream_from_deprecated->execute($_); + ($relationship_id, $O1id) = $sth_downstream_from_deprecated->fetchrow_array; + next unless ($O1id); + $sth3_inherited_object_details = $dbh->prepare("select object_type, object_lsid, description, authority, contact_email from object where object_id=?"); + $sth3_inherited_object_details->execute($O1id); + ($type, $lsid, $description, $authority, $contact_email) = $sth3_inherited_object_details->fetchrow_array(); + next unless ($type); + open OUT, ">>UPDATE_ERROR_LOG"; + print OUT "Object $type and its children are now broken through HASA linkage\n"; + close OUT; + print " Object $type in your ontology is now broken as it contains (HASA) a deprecated object!\n"; + + $sth_downstream_from_deprecated = $dbh->prepare("select assertion_id, object1_id from object_term2term where relationship_type='urn:lsid:biomoby.org:objectrelation:has' and object2_id = ?"); + $sth_downstream_from_deprecated->execute($_); + ($relationship_id, $O1id) = $sth_downstream_from_deprecated->fetchrow_array; + next unless ($O1id); + $sth3_inherited_object_details = $dbh->prepare("select object_type, object_lsid, description, authority, contact_email from object where object_id=?"); + $sth3_inherited_object_details->execute($O1id); + ($type, $lsid, $description, $authority, $contact_email) = $sth3_inherited_object_details->fetchrow_array(); + next unless ($type); + open OUT, ">>UPDATE_ERROR_LOG"; + print OUT "Object $type and its children are now broken through HAS linkage\n"; + close OUT; + print " Object $type in your ontology is now broken as it contains (HAS) a deprecated object!\n"; + } -print "\n\nAny error messages have been written to the file UPDATE_ERROR_LOG\n\nDone!\n\n"; \ No newline at end of file +print "\n\nDone!\n\n"; +print "\n\nNOTE: A list of all broken object types resulting from this transformation have been written to the file UPDATE_ERROR_LOG in this script's folder\nYou will need to re-create these objects with the correct inheritence.\n\n"; + From dwang at pub.open-bio.org Fri Aug 26 17:33:24 2005 From: dwang at pub.open-bio.org (Dennis Wang) Date: Fri Aug 26 18:17:07 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508262133.j7QLXOdb009556@pub.open-bio.org> dwang Fri Aug 26 17:33:24 EDT 2005 Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby In directory pub.open-bio.org:/tmp/cvs-serv9530/Perl/MOBY/Adaptor/moby Modified Files: queryapi.pm Log Message: formated documentation spacing moby-live/Perl/MOBY/Adaptor/moby queryapi.pm,1.27,1.28 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/08/04 02:12:52 1.27 +++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/08/26 21:33:24 1.28 @@ -299,7 +299,7 @@ Args : service_lsid => String Returns : listref of hashrefs: [{collection_input_id => Integer - article_name => String}, ...] + article_name => String}, ...] one hashref for each collection that service consumes Notes : the fact that it returns a collection_input_id is bad since this is only useful to an SQL-based API... @@ -314,7 +314,7 @@ Usage : my $un = $API->insert_collection_input(%args) Function : Inserts a Collection input into the database Args : article_name => String, - service_instance_lsid => String, + service_instance_lsid => String, Returns : Integer insertid Notes : the fact that it returns an insertid is bad since this is only useful to an SQL-based API... @@ -330,8 +330,8 @@ Function : Deletes Collection inputs according to the service instance Args : service_instance_lsid => String, Returns : ($err, $errstr) - $err = 1 if there was an delete error, 0 if successful - $errstr = String error message if there was an error + $err = 1 if there was an delete error, 0 if successful + $errstr = String error message if there was an error =cut sub delete_collection_input{ @@ -348,9 +348,9 @@ Function : Executes a query for Collection outputs according to the service instance Args : service_instance_lsid => String, Returns : listref of hashrefs: - [{collection_output_id => Integer, - article_name => String, - service_instance_id => Integer}, ...] + [{collection_output_id => Integer, + article_name => String, + service_instance_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_collection_output{ @@ -363,7 +363,7 @@ Usage : my $un = $API->insert_collection_output(%args) Function : Inserts a Collection output into the database Args : article_name => String, - service_instance_lsid => String, + service_instance_lsid => String, Returns : Integer insertid Notes : the fact that it returns an insertid is bad since this is only useful to an SQL-based API... @@ -387,8 +387,8 @@ Function : Deletes Collection outputs according to the service instance Args : service_instance_lsid => String, Returns : ($err, $errstr) - $err = 1 if there was an delete error, 0 if successful - $errstr = String error message if there was an error + $err = 1 if there was an delete error, 0 if successful + $errstr = String error message if there was an error =cut sub delete_collection_output{ @@ -406,12 +406,12 @@ Args : service_instance_lsid => String, collection_input_id => Integer Returns : listref of hashrefs: - [{simple_input_id => Integer, - object_type_uri => String, - namespace_type_uris => String, - article_name => String, - service_instance_id => Integer, - collection_input_id => Integer}, ...] + [{simple_input_id => Integer, + object_type_uri => String, + namespace_type_uris => String, + article_name => String, + service_instance_id => Integer, + collection_input_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_simple_input{ @@ -424,10 +424,10 @@ Usage : my $un = $API->insert_simple_input(%args) Function : Inserts a Simple input into the database Args : object_type_uri => String, - namespace_type_uris => String, - article_name => String, - service_instance_lsid => String, - collection_input_id => Integer + namespace_type_uris => String, + article_name => String, + service_instance_lsid => String, + collection_input_id => Integer Returns : Integer insertid Notes : the fact that it returns an insertid is bad since this is only useful to an SQL-based API... @@ -444,8 +444,8 @@ Args : service_instance_lsid => String, collection_input_id => Integer Returns : ($err, $errstr) - $err = 1 if there was an delete error, 0 if successful - $errstr = String error message if there was an error + $err = 1 if there was an delete error, 0 if successful + $errstr = String error message if there was an error =cut sub delete_simple_input{ @@ -463,12 +463,12 @@ Args : service_instance_lsid => String, collection_output_id => Integer Returns : listref of hashrefs: - [{simple_output_id => Integer, - object_type_uri => String, - namespace_type_uris => String, - article_name => String, - service_instance_id => Integer, - collection_output_id => Integer}, ...] + [{simple_output_id => Integer, + object_type_uri => String, + namespace_type_uris => String, + article_name => String, + service_instance_id => Integer, + collection_output_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_simple_output{ @@ -481,10 +481,10 @@ Usage : my $un = $API->insert_simple_output(%args) Function : Inserts a Simple output into the database Args : object_type_uri => String, - namespace_type_uris => String, - article_name => String, - service_instance_lsid => String, - collection_output_id => Integer + namespace_type_uris => String, + article_name => String, + service_instance_lsid => String, + collection_output_id => Integer Returns : Integer insertid Notes : the fact that it returns an insertid is bad since this is only useful to an SQL-based API... @@ -501,8 +501,8 @@ Args : service_instance_lsid => String, collection_output_id => Integer Returns : ($err, $errstr) - $err = 1 if there was an delete error, 0 if successful - $errstr = String error message if there was an error + $err = 1 if there was an delete error, 0 if successful + $errstr = String error message if there was an error =cut sub delete_simple_output{ @@ -517,14 +517,14 @@ Function : Executes a query for Secondary input articles in the database Args : service_instance_lsid => String Returns : listref of hashrefs: - [{secondary_input_id => Integer, - default_value => String, - maximum_value => Float, - minimum_value => Float, - enum_value => String, - datatype => String, - article_name => String, - service_instance_id => Integer}, ...] + [{secondary_input_id => Integer, + default_value => String, + maximum_value => Float, + minimum_value => Float, + enum_value => String, + datatype => String, + article_name => String, + service_instance_id => Integer}, ...] Notes : Only allows querying by lsid or type term, so service_instance_id is retrieved from lsid or term =cut sub query_secondary_input{ @@ -537,12 +537,12 @@ Usage : my $un = $API->insert_secondar_input(%args) Function : Inserts a Secondary input into the database Args : default_value => String, - maximum_value => Float, - minimum_value => Float, - enum_value => String, - datatype => String, - article_name => String, - service_instance_lsid => String + maximum_value => Float, + minimum_value => Float, + enum_value => String, + datatype => String, + article_name => String, + service_instance_lsid => String Returns : Integer insertid Notes : the fact that it returns an insertid is bad since this is only useful to an SQL-based API... From senger at pub.open-bio.org Sat Aug 27 16:21:49 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 27 17:06:04 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508272021.j7RKLnvp026769@pub.open-bio.org> senger Sat Aug 27 16:21:49 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs/images In directory pub.open-bio.org:/tmp/cvs-serv26754/images Added Files: service-api-example-small.png service-api-example.png Log Message: moby-live/Java/docs/images service-api-example-small.png,NONE,1.1 service-api-example.png,NONE,1.1 From senger at pub.open-bio.org Sat Aug 27 16:20:48 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 27 17:06:11 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508272020.j7RKKmhc026706@pub.open-bio.org> senger Sat Aug 27 16:20:48 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs/images In directory pub.open-bio.org:/tmp/cvs-serv26668/images Modified Files: stylesheet.css Added Files: arbeiter.gif linuxinsidenotebook-smaller.jpg Log Message: moby-live/Java/docs/images arbeiter.gif,NONE,1.1 linuxinsidenotebook-smaller.jpg,NONE,1.1 stylesheet.css,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/images/stylesheet.css,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/05/19 10:56:06 1.1 +++ /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/08/27 20:20:48 1.2 @@ -57,3 +57,9 @@ .address { font-size: 5pt; margin-right:1em } .smaller { font-size: 8pt } + +pre.code { border: ridge; + padding: 5px; + background-color:#FFFF99; + color: navy; + } From senger at pub.open-bio.org Sat Aug 27 16:20:48 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 27 17:06:15 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508272020.j7RKKmfD026687@pub.open-bio.org> senger Sat Aug 27 16:20:48 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv26668 Modified Files: Moses.html Log Message: moby-live/Java/docs Moses.html,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Moses.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/26 06:40:52 1.1 +++ /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/27 20:20:48 1.2 @@ -10,21 +10,268 @@

    MoSeS - Moby Services Support

    -Documentation in progress...

    +The MoSeS project hopes to give a full support for those who are +writing Biomoby services. And because the Biomoby data exchange format +is symmetric (data from and to services have the same structure) the +support (such as a general XML parser for Biomoby data) can be used +also for clients.

    -Expected before end of August 2005!

    +The current Moses is for Java services - but not much is missing and +Moses can produce also code in Perl (if you think that it would be +useful let me know).

    + +

    Overview

    +The basic idea is not new - it was already implemented in other +languages for Biomoby: take descriptions of Biomoby data types from a +registry and generate Java classes for all these data types, keeping +in place their hierarchy. Once we have Java representation of all data +types, we can generate also code for a Biomoby service that will be +using strongly-typed access to all incoming and out-coming data. An +implementation of such service will inherit from a generated +service skeleton in such way that all processing of Biomoby +XML is hidden.

    + +This is an example of a full implementation of a service called +HelloBiomobyWorld that does not expect any input and produce +a String data type (with a predictable contents) (the code is +available in jMoby):

    + +

    +package org.jmoby.tutorial.service;
    +
    +import net.jmoby.samples.HelloBiomobyWorldSkel;
    +import org.biomoby.shared.MobyException;
    +import org.biomoby.shared.parser.MobyPackage;
    +import org.biomoby.shared.parser.MobyJob;
    +import org.biomoby.shared.datatypes.*;
    +
    +public class HelloBiomobyWorldImpl
    +    extends HelloBiomobyWorldSkel {
    +
    +    public void processIt (MobyJob request,
    +			   MobyJob response,
    +			   MobyPackage outputContext)
    +	throws MobyException {
    +	set_greeting (response, new MobyString ("Hello, World!"));
    +    }
    +}
    +
    +

    + +The service was registered in a Biomoby registry as follows:

    + +

    +<Services>
    +  <Service authURI='samples.jmoby.net'
    +    serviceName='HelloBiomobyWorld'
    +    lsid='urn:lsid:biomoby.org:serviceinstance:samples.jmoby.net,HelloBiomobyWorld'>
    +    <serviceType>Retrieval</serviceType>
    +    <authoritative>1</authoritative>
    +    <Category>moby</Category>
    +    <Description>
    +This is a cult service, known to an exclusive group of persons sharing an esoteric
    +interest. One of their believes is that a word started on January, 1 1970.
    +    </Description>
    +    <contactEmail>martin.senger@gmail.com</contactEmail>
    +    <signatureURL></signatureURL>
    +    <URL>http://localhost:8080/axis/services/</URL>
    +    <Input>
    +    </Input>
    +    <Output>
    +      <Simple articleName='greeting'>
    +        <objectType>String</objectType>
    +      </Simple>
    +    </Output>
    +    <secondaryArticles>
    +    </secondaryArticles>
    +  </Service>
    +</Services>
    +
    + +I have highlighted in both pictures a word greeting. It is an +article name in a Biomoby registry, and it became a method name in a +service implementation.

    + +The same happens also with data types name, as shown in the second +example (here it shows only part of the implementation class but its +full version is in jMoby):

    + +

    +    /**************************************************************************
    +     * This is a mandatory method to be implemented.
    +     *************************************************************************/
    +    public void processIt (MobyJob request,
    +			   MobyJob response,
    +			   MobyPackage outputContext)
    +	throws MobyException {
    + 	Regex input = get_language (request);
    +	if (input == null) return;
    +
    + 	simple_key_value_pair[] output = doBusiness (input);
    + 	set_helloSet (response, output) ;
    +    }
    +
    +    /**************************************************************************
    +     * Here is where the bussines logic is done
    +     *************************************************************************/
    +    protected simple_key_value_pair[] doBusiness (Regex regex)
    +	throws MobyException {
    +
    +	String regExpression = regex.get_regex();
    +	if (isEmpty (regExpression))
    +	    return new simple_key_value_pair[] {};
    +        ...
    +
    +

    + +The Regex and simple_key_value_pair are Biomoby data +types - and you see that you can manipulate them as any Java +object. The other highlighted words are parts of methods - they came +either from the article names or from data types names (where article +names were missing). The suffix Set in one method indicates +that the object will be a Biomoby collection.

    + + + +

    Quick start

    + +Details and explanation follow in the next sections. The examples of +typing assumes that you have a CVS copy of jMoby and you have already +compiled all classes (which is easy to do just by typing +./build.sh.

    + + +

      + +
    1. Register your service (for example, a +service named TheService). Select what data types it will +consume and what data types it will produce. Register the unless they +are already registered. (There is no support in Moses for this +step - there are already several ways how to do it by other +tools.)

      + +

    2. Generate Java classes for all data types, +compile them, packed them into a jar file and let javadoc generate +their API documentation (note that you must have Internet connection +because it explores Biomoby registry): + +
      +  ./build-dev.sh moses-datatypes
      +  
      + +
    3. Generate skeleton for your service, compile +it, generate its API: + +
      +  ./build-dev.sh -Dmoses.service=TheService moses-services
      +  
      + +
    4. Write your own implementation, for example a +class TheServiceImpl, that extends skeleton +TheServiveSkel, and that contains the business logic you want +to have. Compile it, test it (you can test it using the +BaseCmdLineClient even before you deploy it to your +Tomcat). If you place your source code into src/samples - use +whatever package you like - you can compile it using jMoby Ant: + +
      +  ./build-dev.sh
      +  
      + +
    5. Start your Tomcat and deploy your +implementation to your Tomcat (sorry, this is not yet fully +implemented): + +
      +  ./build-dev.sh -Dservice.name=TheService deploy-services
      +  
      + +
    + +

    + + + +

    Main features

    + +The services implemented on top of generated skeletons have implicitly +(i.e. without any need to program) the following features:

    + +

      +
    • They parse data input in Biomoby XML and they produce data in +Biomoby XML format. + +
    • They accept and deal with any number of Biomoby jobs +in one request (a job is what Biomoby API calls a +query, and what is expressed inside one mobyData +Biomoby XML). + +
    • They can accept XML data as string or as a byte array +- as required by the Biomoby API. + +
    • They are prepared to accept more specialized data types that +they were registered for. This data type can be either an existing +data type in time where the service skeleton was generated, but it can +be also a new data type that was added to Biomoby data types long +after the code for the service was generated. + +
    • The source code of service skeletons contains information about +the service (taken from the registry), including graphs of service +neighbourhood (other services that can be connected with this +one). Here is an example extract from service API:

      + + + +

    • It has built-in access to the deployment parameters (the +parameters that can give service necessary configuration properties, +such as JDBC user name and password). + +
    + +

    + +Some other features are either planned to be added, or to be discussed +how useful they would be, some of them can be done by few lines of +code:

    + +

      + +
    • Providing own testing data. +
    • Providing additional, Biomoby non-compliant methods, +such as ping. +
    • Connecting automatically to a monitoring service, +such as Bionanny. +
    • Supporting automatic data compression (without +breaking clients that do no support it). + +
    +

    + + + +

    MoSeS Components

    + + + + +

    + +Documentation in progress... (as long as I can keep my eyes open):

    + +

    + +Will be (almost) finished before the end of August 2005... + +


    Martin Senger
    -Last modified: Fri Aug 26 00:56:35 2005 +Last modified: Sun Aug 28 05:14:21 2005
    - - - From senger at pub.open-bio.org Sat Aug 27 16:33:39 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 27 17:17:24 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508272033.j7RKXd8A026831@pub.open-bio.org> senger Sat Aug 27 16:33:39 EDT 2005 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv26812 Modified Files: build.xml Log Message: moby-live/Java build.xml,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/build.xml 2005/08/26 06:27:02 1.19 +++ /home/repository/moby/moby-live/Java/build.xml 2005/08/27 20:33:39 1.20 @@ -618,21 +618,6 @@ - - - - - - - - - - - - - -
    @@ -687,6 +672,7 @@ + @@ -1077,6 +1063,9 @@ + + + @@ -1098,6 +1087,8 @@ + + From senger at pub.open-bio.org Sat Aug 27 17:00:34 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 27 17:43:55 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508272100.j7RL0YOx026945@pub.open-bio.org> senger Sat Aug 27 17:00:34 EDT 2005 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv26926 Modified Files: build.xml Log Message: moby-live/Java build.xml,1.20,1.21 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/build.xml 2005/08/27 20:33:39 1.20 +++ /home/repository/moby/moby-live/Java/build.xml 2005/08/27 21:00:34 1.21 @@ -1142,6 +1142,8 @@ + + From senger at pub.open-bio.org Sat Aug 27 17:32:23 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 27 18:16:01 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508272132.j7RLWNl2027063@pub.open-bio.org> senger Sat Aug 27 17:32:23 EDT 2005 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv27044 Modified Files: build.xml Log Message: moby-live/Java build.xml,1.21,1.22 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- /home/repository/moby/moby-live/Java/build.xml 2005/08/27 21:00:34 1.21 +++ /home/repository/moby/moby-live/Java/build.xml 2005/08/27 21:32:23 1.22 @@ -983,6 +983,9 @@ + + + @@ -1002,6 +1005,8 @@ + + From senger at pub.open-bio.org Sat Aug 27 17:38:03 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sat Aug 27 18:21:36 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508272138.j7RLc3Cr027133@pub.open-bio.org> senger Sat Aug 27 17:38:03 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv27114/docs Modified Files: Moses.html Log Message: moby-live/Java/docs Moses.html,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Moses.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/27 20:20:48 1.2 +++ /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/27 21:38:03 1.3 @@ -262,7 +262,11 @@

    -Will be (almost) finished before the end of August 2005... +Will be (almost) finished before the end of August 2005...

    + +Look here: API of generated data types and services.

    @@ -270,7 +274,7 @@

    Martin Senger
    -Last modified: Sun Aug 28 05:14:21 2005 +Last modified: Sun Aug 28 06:32:31 2005
    From senger at pub.open-bio.org Sun Aug 28 06:19:08 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 28 07:05:14 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508281019.j7SAJ8GN005396@pub.open-bio.org> senger Sun Aug 28 06:19:08 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs/images In directory pub.open-bio.org:/tmp/cvs-serv5357/docs/images Modified Files: stylesheet.css Added Files: dragon-service-api-small.jpg dragon-service-api.jpg service-api-example-small.jpg Removed Files: service-api-example-small.png Log Message: moby-live/Java/docs/images dragon-service-api-small.jpg,NONE,1.1 dragon-service-api.jpg,NONE,1.1 service-api-example-small.jpg,NONE,1.1 stylesheet.css,1.2,1.3 service-api-example-small.png,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/images/stylesheet.css,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/08/27 20:20:48 1.2 +++ /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/08/28 10:19:08 1.3 @@ -58,8 +58,25 @@ .address { font-size: 5pt; margin-right:1em } .smaller { font-size: 8pt } +.note { font-style: italic; + padding-left: 5em; + margin: 1em; + } + pre.code { border: ridge; padding: 5px; background-color:#FFFF99; color: navy; } + +pre.script { + padding: 5px; + background-color: white; + color: navy; + } + +tr.options { + background-color: #FFFF99; + color: navy; + } + rcsdiff: /home/repository/moby/moby-live/Java/docs/images/RCS/service-api-example-small.png,v: No such file or directory From senger at pub.open-bio.org Sun Aug 28 06:19:08 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 28 07:05:36 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508281019.j7SAJ8xo005376@pub.open-bio.org> senger Sun Aug 28 06:19:08 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv5357/docs Modified Files: Moses.html Added Files: Moses-generators.html Moses-parser.html Log Message: moby-live/Java/docs Moses-generators.html,NONE,1.1 Moses-parser.html,NONE,1.1 Moses.html,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Moses.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/27 21:38:03 1.3 +++ /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/28 10:19:08 1.4 @@ -38,6 +38,7 @@ a String data type (with a predictable contents) (the code is available in jMoby):

    +

     package org.jmoby.tutorial.service;
     
    @@ -58,10 +59,12 @@
         }
     }
     
    +

    The service was registered in a Biomoby registry as follows:

    +

     <Services>
       <Service authURI='samples.jmoby.net'
    @@ -89,6 +92,7 @@
       </Service>
     </Services>
     
    +
    I have highlighted in both pictures a word greeting. It is an article name in a Biomoby registry, and it became a method name in a @@ -98,6 +102,7 @@ example (here it shows only part of the implementation class but its full version is in jMoby):

    +

         /**************************************************************************
          * This is a mandatory method to be implemented.
    @@ -124,6 +129,7 @@
     	    return new simple_key_value_pair[] {};
             ...
     
    +

    The Regex and simple_key_value_pair are Biomoby data @@ -157,16 +163,20 @@ their API documentation (note that you must have Internet connection because it explores Biomoby registry): -

    -  ./build-dev.sh moses-datatypes
    -  
    +
    +
    +./build-dev.sh moses-datatypes
    +
    +
  • Generate skeleton for your service, compile it, generate its API: -
    -  ./build-dev.sh -Dmoses.service=TheService moses-services
    -  
    +
    +
    +./build-dev.sh -Dmoses.service=TheService moses-services
    +
    +
  • Write your own implementation, for example a class TheServiceImpl, that extends skeleton @@ -176,17 +186,21 @@ Tomcat). If you place your source code into src/samples - use whatever package you like - you can compile it using jMoby Ant: -
    -  ./build-dev.sh
    -  
    +
    +
    +./build-dev.sh
    +
    +
  • Start your Tomcat and deploy your implementation to your Tomcat (sorry, this is not yet fully implemented): -
    -  ./build-dev.sh -Dservice.name=TheService deploy-services
    -  
    +
    +
    +./build-dev.sh -Dservice.name=TheService deploy-services
    +
    +
    @@ -222,7 +236,7 @@ neighbourhood (other services that can be connected with this one). Here is an example extract from service API:

    - +

  • It has built-in access to the deployment parameters (the parameters that can give service necessary configuration properties, @@ -253,9 +267,36 @@

    MoSeS Components

    +The documents listed below explain in details the whole Moses +project. Because the main purpose of Moses is to support service +providers, sometimes documentation focuses more on development ("how +to write a code", "how it is done") rather on a randomly walking-in +end-users ("how to use it"). If you are the latter you may find most +in the sections describing various supporting command-line +clients.

    +The Moses consists of four major parts:

    + +

    + + +


    Documentation in progress... (as long as I can keep my eyes open):

    @@ -264,17 +305,13 @@ Will be (almost) finished before the end of August 2005...

    -Look here: API of generated data types and services. -


    Martin Senger
    -Last modified: Sun Aug 28 06:32:31 2005 +Last modified: Sun Aug 28 19:03:43 2005
    From senger at pub.open-bio.org Sun Aug 28 06:19:08 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 28 07:05:38 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508281019.j7SAJ8eS005416@pub.open-bio.org> senger Sun Aug 28 06:19:08 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory pub.open-bio.org:/tmp/cvs-serv5357/src/main/org/biomoby/service Modified Files: BaseService.java Log Message: moby-live/Java/src/main/org/biomoby/service BaseService.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/BaseService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/BaseService.java 2005/08/26 06:27:04 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/BaseService.java 2005/08/28 10:19:08 1.2 @@ -300,7 +300,7 @@ /************************************************************************** * A job-level processing: This is the main method to be - * overriden by a service provider!. Here all thye business + * overriden by a service provider!. Here all the business * logic belongs.

    * * This method is called once for each job in a client From senger at pub.open-bio.org Sun Aug 28 06:21:46 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 28 07:05:44 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508281021.j7SALkLn005529@pub.open-bio.org> senger Sun Aug 28 06:21:46 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs/images In directory pub.open-bio.org:/tmp/cvs-serv5514/docs/images Added Files: DNASequenceWithGFFFeatures-smaller.jpg DNASequenceWithGFFFeatures.png TropGENE_LOCUS-smaller.jpg TropGENE_LOCUS.png moses2-icon.jpg service-inheritance.png Log Message: moby-live/Java/docs/images DNASequenceWithGFFFeatures-smaller.jpg,NONE,1.1 DNASequenceWithGFFFeatures.png,NONE,1.1 TropGENE_LOCUS-smaller.jpg,NONE,1.1 TropGENE_LOCUS.png,NONE,1.1 moses2-icon.jpg,NONE,1.1 service-inheritance.png,NONE,1.1 From senger at pub.open-bio.org Sun Aug 28 06:43:27 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 28 07:29:15 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508281043.j7SAhRHq005650@pub.open-bio.org> senger Sun Aug 28 06:43:27 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs/images In directory pub.open-bio.org:/tmp/cvs-serv5612/docs/images Added Files: new.gif Log Message: moby-live/Java/docs/images new.gif,NONE,1.1 From senger at pub.open-bio.org Sun Aug 28 06:43:27 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Sun Aug 28 07:29:27 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508281043.j7SAhR3A005635@pub.open-bio.org> senger Sun Aug 28 06:43:27 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv5612/docs Modified Files: Moses-generators.html index.html Log Message: moby-live/Java/docs Moses-generators.html,1.1,1.2 index.html,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Moses-generators.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/docs/Moses-generators.html 2005/08/28 10:19:08 1.1 +++ /home/repository/moby/moby-live/Java/docs/Moses-generators.html 2005/08/28 10:43:27 1.2 @@ -664,7 +664,7 @@ There are other useful methods to use - check the API -of the Baseservice for details.

    +of the BaseService for details.

    Now, when you know what method to implement, is time to see what access you have to the data sent by a client, and what means you have @@ -679,7 +679,7 @@

    Martin Senger
    -Last modified: Sun Aug 28 19:13:00 2005 +Last modified: Sun Aug 28 19:17:38 2005
    =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/docs/index.html 2005/08/07 06:36:33 1.12 +++ /home/repository/moby/moby-live/Java/docs/index.html 2005/08/28 10:43:27 1.13 @@ -51,6 +51,7 @@
  • How to develop with jMoby
      +
    • MoSeS - Moby Services Support
    • The Twelve Commandments for jMoby developers (and some good advice)
    • Directories and packages names explained
    • Available APIs @@ -88,7 +89,7 @@
      Martin Senger
      -Last modified: Sun Aug 7 15:04:18 2005 +Last modified: Sun Aug 28 19:37:25 2005
      From senger at pub.open-bio.org Mon Aug 29 09:14:42 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 09:57:43 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291314.j7TDEgg3013473@pub.open-bio.org> senger Mon Aug 29 09:14:42 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/client In directory pub.open-bio.org:/tmp/cvs-serv13455/src/samples/org/jmoby/tutorial/client Log Message: Directory /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/client added to the repository moby-live/Java/src/samples/org/jmoby/tutorial/client - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/client/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/client/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/client/RCS/directory,v: No such file or directory From senger at pub.open-bio.org Mon Aug 29 09:21:59 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:06:01 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291321.j7TDLxNd013525@pub.open-bio.org> senger Mon Aug 29 09:21:59 EDT 2005 Update of /home/repository/moby/moby-live/Java In directory pub.open-bio.org:/tmp/cvs-serv13506 Modified Files: build.xml Log Message: moby-live/Java build.xml,1.22,1.23 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- /home/repository/moby/moby-live/Java/build.xml 2005/08/27 21:32:23 1.22 +++ /home/repository/moby/moby-live/Java/build.xml 2005/08/29 13:21:59 1.23 @@ -944,9 +944,10 @@ moses-init moses-compile moses-docs + moses-jars The jar targets packed separately datatypes and services into -'build/lib' under names 'bimoby-datatypes.jar' and +'build/lib' under names 'biomoby-datatypes.jar' and 'biomoby-skeletons'. The moses-docs target calls javadoc on all generated sources @@ -1036,7 +1037,7 @@ - + @@ -1109,7 +1110,7 @@ - + @@ -1232,6 +1233,13 @@ + + + + + + From senger at pub.open-bio.org Mon Aug 29 09:21:59 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:06:07 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291321.j7TDLxxv013576@pub.open-bio.org> senger Mon Aug 29 09:21:59 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs/images In directory pub.open-bio.org:/tmp/cvs-serv13506/docs/images Modified Files: stylesheet.css Added Files: client-processing-colors.dot client-processing-colors.png client-processing.png data-containers.png Log Message: moby-live/Java/docs/images client-processing-colors.dot,NONE,1.1 client-processing-colors.png,NONE,1.1 client-processing.png,NONE,1.1 data-containers.png,NONE,1.1 stylesheet.css,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/images/stylesheet.css,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/08/28 10:19:08 1.3 +++ /home/repository/moby/moby-live/Java/docs/images/stylesheet.css 2005/08/29 13:21:59 1.4 @@ -75,6 +75,19 @@ color: navy; } +pre.sscript { + padding: 5px; + background-color: white; + color: navy; + font-size: 8pt; + } +pre.ssscript { + padding: 5px; + background-color: white; + color: navy; + font-size: 6pt; + } + tr.options { background-color: #FFFF99; color: navy; From senger at pub.open-bio.org Mon Aug 29 09:21:59 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:06:21 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291321.j7TDLxhd013623@pub.open-bio.org> senger Mon Aug 29 09:21:59 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files In directory pub.open-bio.org:/tmp/cvs-serv13506/src/main/org/biomoby/client/doc-files Modified Files: client-processing.dot client-processing.png Log Message: moby-live/Java/src/main/org/biomoby/client/doc-files client-processing.dot,1.1,1.2 client-processing.png,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/client-processing.dot,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/client-processing.dot 2005/08/26 06:27:04 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/client-processing.dot 2005/08/29 13:21:59 1.2 @@ -1,16 +1,16 @@ digraph ClientProcessing { rankdir=TB; - edge [arrowhead=empty,arrowname=onormal]; + edge [arrowhead=open]; node [shape=rectangle]; Start [shape=circle]; - fillRequest1 [label="fillRequest(XML)"]; - fillRequest2 [label="fillRequest(MobyPackage)"]; - fillRequest3 [label="fillRequest(MobyJob)",shape=hexagon]; - - useResponse1 [label="useResponse(XML)"]; - useResponse2 [label="useResponse(MobyPackage)"]; - useResponse3 [label="useResponse(MobyJob)",shape=hexagon]; + fillRequest1 [label="fillRequest(XML)",fillcolor=lightskyblue2,style=filled]; + fillRequest2 [label="fillRequest(MobyPackage)",fillcolor=palegoldenrod,style=filled]; + fillRequest3 [label="fillRequest(MobyJob)",shape=hexagon,fillcolor=olivedrab1,style=filled]; + + useResponse1 [label="useResponse(XML)",fillcolor=lightskyblue2,style=filled]; + useResponse2 [label="useResponse(MobyPackage)",fillcolor=palegoldenrod,style=filled]; + useResponse3 [label="useResponse(MobyJob)",shape=hexagon,fillcolor=olivedrab1,style=filled]; createEmpty [label="create empty\nMobyPackage"]; createXML [label="create XML"]; @@ -18,33 +18,29 @@ callRemoteService1 [label="callRemoteService()"]; callRemoteService2 [label="callRemoteService()"]; - getServiceLocator1 [label="getServiceLocator()"]; - getServiceLocator2 [label="getServiceLocator()"]; + getServiceLocator1 [label="getServiceLocator()",fillcolor=olivedrab1,style=filled]; + getServiceLocator2 [label="getServiceLocator()",fillcolor=olivedrab1,style=filled]; End [shape=circle]; Start -> fillRequest1; fillRequest1 -> createEmpty [label="if null"]; createEmpty -> fillRequest2; - fillRequest2 -> fillRequest3 [label="*"]; - fillRequest3 -> fillRequest2; - fillRequest2 -> createXML; + fillRequest2 -> fillRequest3 [label="* (iterate)",arrowtail=open]; + fillRequest2 -> createXML [label="if true"]; createXML -> callRemoteService1; - callRemoteService1 -> getServiceLocator1; - getServiceLocator1 -> callRemoteService1; + callRemoteService1 -> getServiceLocator1 [arrowtail=open]; callRemoteService1 -> useResponse1; useResponse1 -> extractXML [label="if true"]; extractXML -> useResponse2; - useResponse2 -> useResponse3 [label="*"]; - useResponse3 -> useResponse2; - useRespomse2 -> End; + useResponse2 -> useResponse3 [label="* (iterate)",arrowtail=open]; + useResponse2 -> End; fillRequest2 -> End [label="if false"]; useResponse1 -> End [label="if false"]; fillRequest1 -> callRemoteService2 [label="if non empty"]; - callRemoteService2 -> getServiceLocator2; - getServiceLocator2 -> callRemoteService2; + callRemoteService2 -> getServiceLocator2 [arrowtail=open]; callRemoteService2 -> useResponse1; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/client-processing.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 Binary files /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/client-processing.png 2005/08/26 06:27:04 1.1 and /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/client-processing.png 2005/08/29 13:21:59 1.2 differ rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/doc-files/client-processing.png: diff failed From senger at pub.open-bio.org Mon Aug 29 09:21:59 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:06:23 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291321.j7TDLxGx013556@pub.open-bio.org> senger Mon Aug 29 09:21:59 EDT 2005 Update of /home/repository/moby/moby-live/Java/docs In directory pub.open-bio.org:/tmp/cvs-serv13506/docs Modified Files: ChangeLog Moses-generators.html Moses-parser.html Moses.html Added Files: Moses-clients.html Log Message: moby-live/Java/docs Moses-clients.html,NONE,1.1 ChangeLog,1.36,1.37 Moses-generators.html,1.2,1.3 Moses-parser.html,1.1,1.2 Moses.html,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/26 06:27:02 1.36 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2005/08/29 13:21:59 1.37 @@ -1,3 +1,7 @@ +2005-08-29 Martin Senger + + * Added project Moses for generating code for service providers. + 2005-08-25 Martin Senger * Clean-up build.xml generally, added there new targets for =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Moses-generators.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/Moses-generators.html 2005/08/28 10:43:27 1.2 +++ /home/repository/moby/moby-live/Java/docs/Moses-generators.html 2005/08/29 13:21:59 1.3 @@ -673,13 +673,107 @@ but here are few basic rules that can make your investigation more efficient:

      -... (pending)... +There are always two ways to get/set data. You can use methods of a +general object MobyJob, or +you can use methods from generated sketeltons.

      + +The methods in MobyJob either get data by name (meaning by an +article name, and only if it does not exist the data type name is +used), or they get data from the first Simple Biomoby type - which +often is the only one. For example: + +

      +
      +public void processIt (MobyJob request,
      +                       MobyJob response,
      +                       MobyPackage outputContext)
      +                       throws MobyException {
      +
      +  // get the first Simple data
      +  System.out.println (request.getData());
      +
      +  // get the Simple data that have article name "Sequence"
      +  System.out.println (request.getData ("Sequence"));
      +
      +  // get the Simple data that have an article name "abc" or none at all,
      +  // AND it is of the type "Regex"
      +  System.out.println (request.getData ("abc", "Regex"));
      +
      +  // get the first Simple that matches the data type "Regex"
      +  System.out.println (request.getData ("", "Regex"));
      +
      +  // get the first Collection
      +  System.out.println (printCol (response.getDataSet()));
      +
      +  // get the Collection data that have article name "Sequences"
      +  System.out.println (printCol (response.getDataSet ("Sequences")));
      +
      +  // get the Collection data that have an article name "abc" or none at all,
      +  // AND its elements are of the type "Regex"
      +  System.out.println (printCol (response.getDataSet ("abc", "Regex")));
      +
      +  // get the first Collection whose elements match the data type "Regex"
      +  System.out.println (printCol (response.getDataSet ("", "Regex")));
      +}
      +
      +private String printCol (MobyObject[] col) {
      +  if (col == null) return "null";
      +  if (col.length == 0) return "empty";
      +  return col[0].toString();
      +}
      +
      +
      + +The MobyJob's getMethod(article-name, +data-type-name) has the following built-in behaviour: + +
        +
      1. Try to find a Simple element matching both the +article name and a data type name. +
      2. If it fails, try to find an unnamed Simple data +element matching just the data type. +
      3. If it fails, and if here given article name is +empty, try to find any Simple data element matching the data type. +
      4. Return null. +
      +

      + +The generated skeletons allows to work directly with the generated +data types. They have methids that have already in their names +corresponding article names and data types names. For example: + +

      +
      +public void processIt (MobyJob request,
      +                       MobyJob response,
      +                       MobyPackage outputContext)
      +                       throws MobyException {
      +  Regex input = get_language (request);
      +  if (input == null) return;
      +
      +  simple_key_value_pair[] output = doBusiness (input);
      +  set_helloSet (response, output) ;
      +}
      +
      +
      + +Note that in the example above the language is an article +name of a Biomoby Simple, Regex is its data type, Also the +simple_key_value_pair is a data type name. The hello +is an article name of an output collection.

      + +The full examples of some Bimoby services are in jMoby in +src/samples directory.

      + + +


      Martin Senger
      -Last modified: Sun Aug 28 19:17:38 2005 +Last modified: Mon Aug 29 11:52:14 2005
      =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Moses-parser.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/docs/Moses-parser.html 2005/08/28 10:19:08 1.1 +++ /home/repository/moby/moby-live/Java/docs/Moses-parser.html 2005/08/29 13:21:59 1.2 @@ -11,14 +11,219 @@ -Documentation is in progress...

      +The Biomoby XML parser has an obvious task: to read a Biomoby XML +stream and convert it into Java objects that can be easily +handled. Its job is usually hidden, a Biomoby service developer rarely +calls the parser directly. But here is an example how to get parsed +Biomoby XML data into a MobyPackage (note that the input XML +- the parameter data in the example - can be given as a +String, byte[], or a File which conveniently corresponds with the +requirement from the Biomoby API): + +

      +
      +try {
      +  MobyPackage mobyInput = MobyPackage.createFromXML (data);
      +
      +  // here do something with 'mobyInput'
      +
      +} catch (MobyException e) {
      +  System.out.println (e.getMessage());
      +}
      +
      +
      + +To bring data back into XML is again simple: + +
      +
      +try {
      +  // fill response data into a mobyOutput...
      +  MobyPackage mobyOutput = new MobyPackage();
      +  ...
      +
      +  // and convert it into XML
      +  String xml = mobyOutput.toXML();
      +
      +} catch (MobyException e) {
      +  System.out.println (e.getMessage());
      +}
      +
      +
      + +On the other hand, what is visible to the service developers, +and what they are working with often, are the Java objects created by +the parser. This is a high-level overview of them, and how they +correspond to the Biomoby XML tags: +

      + +

      + + + + + + + + + + + + + + + +
      Biomoby XML tag Java object
      MOBY, mobyContent +org.biomoby.shared.parser.MobyPackage +
      mobyData +org.biomoby.shared.parser.MobyJob +
      Simple +org.biomoby.shared.parser.MobySimple +
      Collection +org.biomoby.shared.parser.MobyCollection +
      Parameter +org.biomoby.shared.parser.MobyParameter +
      Object and its children + +org.biomoby.shared.datatypes.MobyObject
      +org.biomoby.shared.datatypes.MobyString
      +org.biomoby.shared.datatypes.MobyInteger
      +org.biomoby.shared.datatypes.MobyFloat
      +org.biomoby.shared.datatypes.MobyBoolean
      +org.biomoby.shared.datatypes.MobyDateTime
      +
      and all generated data types in org.biomoby.shared.datatypes.* +
      CrossReference +org.biomoby.shared.datatypes.MobyXref +
      ProvisionInformation +org.biomoby.shared.data.MobyProvisionInfo +
      +
      + +A MobyPackage contains one or more MobyJobs each of +them containing one "execution" (or a "query" in a Biomoby +speak). Note that a Biomoby service must be able to accept more +invocations (jobs, queries) from one network request. A +MobyJob also carries a response from a service.

      + +A MobyJob has the data themselves - they are either stored in +MobySimples or in MobyCollections. The number and +types of these MobyDataElements are defined for each Biomoby +service in a Biomoby registry.

      + +The MobySimples have data stored in various data objects - +their classes are in the package +org.biomoby.shared.datatypes. The primitive data types are +there available directly, the other types are to be generated - see +details in a separate +document.

      + +Here is a picture showing how the entities are relates:

      + +

      +

      +

      +

      + + + + + +

      Command-line client for the parser

      + +As said above, a developer rarely needs to invoke the parser +directly. But because the life is not perfect (yet, but with Biomoby +growing it will be, of course), there are moments when we need to test +either parser itself or check some XML data the users are claiming +that they do not work for them. For these moments, there is a +command-line client TestingMobyParser.

      -For the time being, look directly in the API -documentation. +The program can be invoked using a script: -

    +
    +
    +build/run/run-moby-parser [<options>] <filename> 
    +
    +
    + +At the moment, there is no Ant's target to invoke this program.

    + +The program takes the following options, specific for generating data +types:

    + +

    + + + + + + + + + + + + + + + + + + +
    Option/Parameter Ant's property Meaning
    <filename> XML file to be parsed (a mandatory parameter)
    -n it does not print the parsed result (by default it does)
    -r convert back (reverse) the parsed result into XML and print it
    +
    +

    +The reverse converting (with the -r option) has an interesting +usage. The resulting XML is not usually identical with the original - +it may have different formatting, it probably has more XML namespace +prefixes (they are everywhere), but more importantly, it may not +reflect all data that was in the original input. This is because the +parser ignores all values that are not carried by (and only by) the +Biomoby primitives types (as it was allowed before big change in +summer 2005). So you can use this option to see if your XML data are +up-to-date with the Biomoby API.

    + +Here is a typical examples of invoking the script - the input file +contains an example taken from the Biomoby API documentation:

    + +

    +
    +build/run/run-moby-parser -r example.xml
    +
    +
    + +
    +
    +Authority: http://www.tempcalculator.org/meltyman
    +Jobs (invocations):
    +(1)    Query ID: a1
    +   Data elements:
    +      (Simple) Article name:
    +         MobyFloat, Id: 163483, Namespace: NCBI_gi
    +            Value: 69.8
    +(2)    Query ID: a2
    +   Data elements:
    +      (Simple) Article name:
    +         MobyFloat, Id: 635543, Namespace: NCBI_gi
    +            Value: 72.1
    +
    +<?xml version="1.0" encoding="UTF-8"?>
    +<moby:MOBY xmlns:moby="http://www.biomoby.org/moby">
    +  <moby:mobyContent moby:authority="http://www.tempcalculator.org/meltyman">
    +    <moby:mobyData moby:queryID="a1">
    +      <moby:Simple>
    +        <moby:Float moby:id="163483" moby:namespace="NCBI_gi">69.8</moby:Float>
    +      </moby:Simple>
    +    </moby:mobyData>
    +    <moby:mobyData moby:queryID="a2">
    +      <moby:Simple>
    +        <moby:Float moby:id="635543" moby:namespace="NCBI_gi">72.1</moby:Float>
    +      </moby:Simple>
    +    </moby:mobyData>
    +  </moby:mobyContent>
    +</moby:MOBY>
    +
    +

    @@ -26,7 +231,7 @@

    Martin Senger
    -Last modified: Sun Aug 28 18:39:46 2005 +Last modified: Mon Aug 29 10:43:33 2005
    =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Moses.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/28 10:19:08 1.4 +++ /home/repository/moby/moby-live/Java/docs/Moses.html 2005/08/29 13:21:59 1.5 @@ -20,6 +20,43 @@ Moses can produce also code in Perl (if you think that it would be useful let me know).

    + +

    MoSeS Components

    + +The documents listed below explain in details the whole Moses +project. Because the main purpose of Moses is to support service +providers, sometimes documentation focuses more on development ("how +to write a code", "how it is done") rather on a randomly walking-in +end-users ("how to use it"). If you are the latter you may find most +in the sections describing various supporting command-line +clients.

    + + +The Moses consists of four major parts:

    + +

    + +

    Overview

    @@ -264,38 +301,6 @@

    - -

    MoSeS Components

    - -The documents listed below explain in details the whole Moses -project. Because the main purpose of Moses is to support service -providers, sometimes documentation focuses more on development ("how -to write a code", "how it is done") rather on a randomly walking-in -end-users ("how to use it"). If you are the latter you may find most -in the sections describing various supporting command-line -clients.

    - - -The Moses consists of four major parts:

    - -

    - -


    @@ -311,7 +316,7 @@

    Martin Senger
    -Last modified: Sun Aug 28 19:03:43 2005 +Last modified: Mon Aug 29 16:07:55 2005
    From senger at pub.open-bio.org Mon Aug 29 09:21:59 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:06:27 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291321.j7TDLxrj013595@pub.open-bio.org> senger Mon Aug 29 09:21:59 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory pub.open-bio.org:/tmp/cvs-serv13506/src/main/org/biomoby/client Modified Files: MobyServiceLocator.java Log Message: moby-live/Java/src/main/org/biomoby/client MobyServiceLocator.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyServiceLocator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyServiceLocator.java 2005/08/26 06:40:53 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyServiceLocator.java 2005/08/29 13:21:59 1.2 @@ -39,6 +39,13 @@ } /************************************************************************** + * Another constructor, seeting also a service. + *************************************************************************/ + public MobyServiceLocator (MobyService service) { + setService (service); + } + + /************************************************************************** * *************************************************************************/ public MobyService getService() { From senger at pub.open-bio.org Mon Aug 29 09:22:00 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:51:32 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291322.j7TDM0OI013646@pub.open-bio.org> senger Mon Aug 29 09:22:00 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes In directory pub.open-bio.org:/tmp/cvs-serv13506/src/main/org/biomoby/shared/datatypes Modified Files: MapDataTypesIfc.java MapPrimitiveDataTypes.java Log Message: moby-live/Java/src/main/org/biomoby/shared/datatypes MapDataTypesIfc.java,1.1,1.2 MapPrimitiveDataTypes.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapDataTypesIfc.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapDataTypesIfc.java 2005/08/26 06:27:05 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapDataTypesIfc.java 2005/08/29 13:21:59 1.2 @@ -6,8 +6,11 @@ public interface MapDataTypesIfc { void makeSureItIsLoaded(); + Class getClass (String dataTypeName) throws org.biomoby.shared.MobyException; + String getClassName (String dataTypeName); + int getMappingSize(); } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java 2005/08/26 06:27:05 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java 2005/08/29 13:21:59 1.2 @@ -93,5 +93,9 @@ return (String)type2class.get (dataTypeName); } + public int getMappingSize() { + return type2class.size(); + } + } From senger at pub.open-bio.org Mon Aug 29 09:22:00 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:51:35 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291322.j7TDM0Nn013671@pub.open-bio.org> senger Mon Aug 29 09:22:00 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files In directory pub.open-bio.org:/tmp/cvs-serv13506/src/main/org/biomoby/shared/parser/doc-files Modified Files: data-containers.dot data-containers.png Log Message: moby-live/Java/src/main/org/biomoby/shared/parser/doc-files data-containers.dot,1.1,1.2 data-containers.png,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/data-containers.dot,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/data-containers.dot 2005/08/26 06:27:05 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/data-containers.dot 2005/08/29 13:22:00 1.2 @@ -10,8 +10,8 @@ MobyDataElement -> MobyCollection; MobyDataElement -> MobyParameter; MobyCollection -> MobySimple2 [label="1..*",arrowtail=diamond]; - MobyData1 [label="MobyData"]; - MobyData2 [label="MobyData"]; + MobyData1 [label="MobyObject"]; + MobyData2 [label="MobyObject"]; MobySimple1 -> MobyData1 [arrowtail=diamond]; MobySimple2 -> MobyData2 [arrowtail=diamond]; Primitives1 [label="MobyString\nMobyInteger\nMobyFloat\nMobyBoolean\nMobyDateTime"]; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/data-containers.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 Binary files /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/data-containers.png 2005/08/26 06:27:05 1.1 and /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/data-containers.png 2005/08/29 13:22:00 1.2 differ rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/parser/doc-files/data-containers.png: diff failed From senger at pub.open-bio.org Mon Aug 29 09:22:00 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Mon Aug 29 10:51:36 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508291322.j7TDM0PS013692@pub.open-bio.org> senger Mon Aug 29 09:22:00 EDT 2005 Update of /home/repository/moby/moby-live/Java/src/samples/org/jmoby/tutorial/client In directory pub.open-bio.org:/tmp/cvs-serv13506/src/samples/org/jmoby/tutorial/client Added Files: MabuhayClient.java MabuhayClient2.java Log Message: moby-live/Java/src/samples/org/jmoby/tutorial/client MabuhayClient.java,NONE,1.1 MabuhayClient2.java,NONE,1.1 From lixin at pub.open-bio.org Fri Aug 19 15:21:23 2005 From: lixin at pub.open-bio.org (Lixin Shen) Date: Mon Aug 29 12:37:40 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508191921.j7JJLNkd026054@pub.open-bio.org> lixin Fri Aug 19 15:21:22 EDT 2005 Update of /home/repository/moby/moby-live/Java/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv26029 Added Files: Frame.java MElement.java .project GenericWindowListener.java RdfParser.java Builder.java errors.txt MainGUI.java MElementHashtable.java Makefile DNASequencexsd.xml README PrimitiveVector.java Log Message: this is a xml schema generatot. read README first moby-live/Java/org/biomoby/shared Frame.java,NONE,1.1 MElement.java,NONE,1.1 .project,NONE,1.1 GenericWindowListener.java,NONE,1.1 RdfParser.java,NONE,1.1 Builder.java,NONE,1.1 errors.txt,NONE,1.1 MainGUI.java,NONE,1.1 MElementHashtable.java,NONE,1.1 Makefile,1.4,1.5 DNASequencexsd.xml,NONE,1.1 README,NONE,1.1 PrimitiveVector.java,NONE,1.1 =================================================================== RCS file: /home/repository/moby/moby-live/Java/org/biomoby/shared/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/org/biomoby/shared/Makefile 2003/09/24 12:33:50 1.4 +++ /home/repository/moby/moby-live/Java/org/biomoby/shared/Makefile 2005/08/19 19:21:22 1.5 @@ -1,39 +1,6 @@ -# File: Makefile -# -# Comments to: senger@ebi.ac.uk -# -# ----------------------------------------------------------------------------- - -SOURCE += MobyException NoSuccessException PendingCurationException -SOURCE += Utils -SOURCE += MobyDataType MobyNamespace -SOURCE += MobyData -SOURCE += MobyPrimaryDataSimple MobyPrimaryDataSet MobySecondaryData -SOURCE += MobyServiceType MobyService -SOURCE += Central - -# submodules -DOM = dom - -# ----------------------------------------------------------------------------- - -JAVAC ?= javac - -# class files -CLASSES = $(SOURCE:%=%.class) - -.SUFFIXES: .java .class - -.java.class: - ${JAVAC} ${JFLAGS} $< - -all: submodules ${CLASSES} - -clean: clean_submodules - rm -f *.class - -submodules: - @cd ${DOM} ; ${MAKE} - -clean_submodules: - @cd ${DOM} ; ${MAKE} clean +MainGUI.class: Builder.class MainGUI.java Frame.java GenericWindowListener.java + javac MainGUI.java +Builder.class: Builder.java MElement.java RdfParser.java PrimitiveVector.java MElementHashtable.java + javac Builder.java +clean: + rm *.class From lixin at pub.open-bio.org Fri Aug 19 15:34:04 2005 From: lixin at pub.open-bio.org (Lixin Shen) Date: Mon Aug 29 12:37:50 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508191934.j7JJY41a026441@pub.open-bio.org> lixin Fri Aug 19 15:34:04 EDT 2005 Update of /home/repository/moby/moby-live/Java/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv26408 Removed Files: MElement.java Frame.java Makefile DNASequencexsd.xml RdfParser.java GenericWindowListener.java errors.txt README Builder.java MainGUI.java PrimitiveVector.java MElementHashtable.java Log Message: see if this removes the old source files that are outside of the schema directory moby-live/Java/org/biomoby/shared MElement.java,1.1,NONE Frame.java,1.1,NONE Makefile,1.5,NONE DNASequencexsd.xml,1.1,NONE RdfParser.java,1.1,NONE GenericWindowListener.java,1.1,NONE errors.txt,1.1,NONE README,1.1,NONE Builder.java,1.1,NONE MainGUI.java,1.1,NONE PrimitiveVector.java,1.1,NONE MElementHashtable.java,1.1,NONE rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/MElement.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/Frame.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/Makefile,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/DNASequencexsd.xml,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/RdfParser.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/GenericWindowListener.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/errors.txt,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/README,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/Builder.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/MainGUI.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/PrimitiveVector.java,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/MElementHashtable.java,v: No such file or directory From lixin at pub.open-bio.org Fri Aug 19 15:31:39 2005 From: lixin at pub.open-bio.org (Lixin Shen) Date: Mon Aug 29 12:37:52 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508191931.j7JJVdpG026210@pub.open-bio.org> lixin Fri Aug 19 15:31:39 EDT 2005 Update of /home/repository/moby/moby-live/Java/org/biomoby/shared/schema In directory pub.open-bio.org:/tmp/cvs-serv26186/schema Log Message: Directory /home/repository/moby/moby-live/Java/org/biomoby/shared/schema added to the repository moby-live/Java/org/biomoby/shared/schema - New directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/RCS/directory,v: No such file or directory From lixin at pub.open-bio.org Fri Aug 19 15:31:39 2005 From: lixin at pub.open-bio.org (Lixin Shen) Date: Mon Aug 29 12:37:55 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508191931.j7JJVdgT026228@pub.open-bio.org> lixin Fri Aug 19 15:31:39 EDT 2005 Update of /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/example In directory pub.open-bio.org:/tmp/cvs-serv26186/schema/example Log Message: Directory /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/example added to the repository moby-live/Java/org/biomoby/shared/schema/example - New directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/example/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/example/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/example/RCS/directory,v: No such file or directory From lixin at pub.open-bio.org Fri Aug 19 15:31:42 2005 From: lixin at pub.open-bio.org (Lixin Shen) Date: Mon Aug 29 12:38:03 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508191931.j7JJVgiA026273@pub.open-bio.org> lixin Fri Aug 19 15:31:42 EDT 2005 Update of /home/repository/moby/moby-live/Java/org/biomoby/shared/schema In directory pub.open-bio.org:/tmp/cvs-serv26252/schema Added Files: MElementHashtable.java errors.txt DNASequencexsd.xml Makefile Frame.java GenericWindowListener.java RdfParser.java PrimitiveVector.java MElement.java MainGUI.java README Builder.java Log Message: placed schema generator in schema directory instead of out in the open moby-live/Java/org/biomoby/shared/schema MElementHashtable.java,NONE,1.1 errors.txt,NONE,1.1 DNASequencexsd.xml,NONE,1.1 Makefile,NONE,1.1 Frame.java,NONE,1.1 GenericWindowListener.java,NONE,1.1 RdfParser.java,NONE,1.1 PrimitiveVector.java,NONE,1.1 MElement.java,NONE,1.1 MainGUI.java,NONE,1.1 README,NONE,1.1 Builder.java,NONE,1.1 From lixin at pub.open-bio.org Fri Aug 19 15:31:42 2005 From: lixin at pub.open-bio.org (Lixin Shen) Date: Mon Aug 29 12:38:11 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508191931.j7JJVgVH026288@pub.open-bio.org> lixin Fri Aug 19 15:31:42 EDT 2005 Update of /home/repository/moby/moby-live/Java/org/biomoby/shared/schema/example In directory pub.open-bio.org:/tmp/cvs-serv26252/schema/example Added Files: GFF2.xml SimpleAnnotatedJPEGImage.xsd SimpleAnnotatedJPEGImage.xml BasicGFFSequenceFeature.xml DNASequence.xml BasicGFFSequenceFeature.xsd test_3 DnaSequenceHolderxsd.xml Object.xsd multi_key_value_pair.xsd String.xsd text-plain.xml DnaSequenceHolder.xml test_1 text-plain.xsd test_2 ICIS_Query.xsd test.xsd ICIS_Query.xml multi_key_value_pair.xml String.xml DNASequence.xsd Object.xml GFF2.xsd Log Message: placed schema generator in schema directory instead of out in the open moby-live/Java/org/biomoby/shared/schema/example GFF2.xml,NONE,1.1 SimpleAnnotatedJPEGImage.xsd,NONE,1.1 SimpleAnnotatedJPEGImage.xml,NONE,1.1 BasicGFFSequenceFeature.xml,NONE,1.1 DNASequence.xml,NONE,1.1 BasicGFFSequenceFeature.xsd,NONE,1.1 test_3,NONE,1.1 DnaSequenceHolderxsd.xml,NONE,1.1 Object.xsd,NONE,1.1 multi_key_value_pair.xsd,NONE,1.1 String.xsd,NONE,1.1 text-plain.xml,NONE,1.1 DnaSequenceHolder.xml,NONE,1.1 test_1,NONE,1.1 text-plain.xsd,NONE,1.1 test_2,NONE,1.1 ICIS_Query.xsd,NONE,1.1 test.xsd,NONE,1.1 ICIS_Query.xml,NONE,1.1 multi_key_value_pair.xml,NONE,1.1 String.xml,NONE,1.1 DNASequence.xsd,NONE,1.1 Object.xml,NONE,1.1 GFF2.xsd,NONE,1.1 From mng at pub.open-bio.org Fri Aug 26 16:55:13 2005 From: mng at pub.open-bio.org (michael ng) Date: Mon Aug 29 12:38:14 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200508262055.j7QKtDMp008464@pub.open-bio.org> mng Fri Aug 26 16:55:13 EDT 2005 Update of /home/repository/moby/moby-live/Accessories In directory pub.open-bio.org:/tmp/cvs-serv8437 Modified Files: code-generator0.6.cgi Log Message: with new interface and comment moby-live/Accessories code-generator0.6.cgi,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi 2005/08/09 22:23:46 1.3 +++ /home/repository/moby/moby-live/Accessories/code-generator0.6.cgi 2005/08/26 20:55:13 1.4 @@ -7,6 +7,14 @@ # #******************************************************************************** +##################################################################################################################################### +##################################################################################################################################### + +# Main Function Section + +##################################################################################################################################### +##################################################################################################################################### + use strict; use LWP::UserAgent; use LWP::Simple; @@ -160,7 +168,7 @@ $sqlORalgor_rad = "" if (!$sqlORalgor_rad); $contactEmail = "" if (!$contactEmail) ; $description = "" if (!$description); - $directory = "" if (!$directory); + $directory = "/moby/moby-live/Perl/MOBY" if (!$directory); $genORcom = "" if (!$genORcom); $simORcollInput = "" if (!$simORcollInput); $simORcollOutput = "" if (!$simORcollOutput); @@ -256,6 +264,8 @@ my $simORcollOutput_rad_sim_sel = $simORcollOutput eq "SIMPLE" ? " checked" : ""; my $simORcollOutput_rad_coll_sel = $simORcollOutput eq "COLLECTION" ? " checked" : ""; + my $UI_string = UI_template("1"); + #Print the HTML form out print < @@ -272,14 +282,10 @@ javascript_functions(); #style="overflow:hidden" print < - - -
    -

    Webservice Properties

    -

     

    - - Below are some properties that you have to fill about your webservice. If there is anything you do not understand, just simply put your mouse over the [?] and a short description will appear.
    +$UI_string + + Below are some properties that you have to fill about your webservice.
    + If there is anything you do not understand, click on the [?] and a short description will appear.
    Once you have finished filling in this form, click on the 'Next' button to continue.

    Please fill in the required fields

    @@ -305,7 +311,6 @@ Objects without Secondary[?] Objects with Secondary [?]
    Simple [?] - Collection [?]
    - Directory of MOBY Modules (Default: /moby/moby-live/Perl/MOBY) [?] + Directory of MOBY Modules
    (Default: /moby/moby-live/Perl/MOBY) [?] - SQL Query of Algorithm + SQL Query or Algorithm
    @@ -379,20 +384,22 @@
    - - + +

     

     

    - - + + + HTML_FORM2 } + #********************************************************************************** # # THIS FUNCTION VALIDATES THE FORM AND CHECKS IF ALL THE VALUES HAVE BEEN ENTERED @@ -779,25 +786,16 @@ $dbType_html .= ">$dbTypes_option"; } + my $UI_string = UI_template("2"); #Print the HTML form out print < - - MOBY-S Web Service Auto-Generator - Database Properties + $UI_string - - - -
    -

    Database Properties

    -

     

    - Since your have selected your service as an database base SQL service, you are required to enter your database information inorder to make a connection.
    - Once you have finished filling in the form click on the 'Next' button to continue. -

    Please fill in the required fields

    - + Since your have selected your service as an database base SQL service, you are required to enter your database information in order to make a connection. Once you have finished filling in the form click on the 'Next' button to continue.
    +
    +
    - @@ -858,8 +856,8 @@
    - +

    @@ -875,6 +873,145 @@ } +#*********************************************************************************************************** +# +# SQL INPUT MAPPING FUNCTION +# - description: THIS FUNCTION asks users to provide the names of each of the Input Variable +# Then, we will be associating the Input Parameters' names in the Service URL with the MobyObject id,articels.... so that the MOBY service can retrieve data correctly +# eg. The Service URL has two inputs, X and Y +# MobyObject: GO_Term, GO has String called Term AND has string called Definition +# The user will have to associate "X" with "Term" and "Y" with "Definition" +# +#************************************************************************************************************ +sub mapSQLinput{ + + my $error_msg = shift; + @InParam = shift; + + my $serviceType = $query->param("serviceType"); + my $objectConsumed = $query->param("objectConsumed"); + my $objectProduced = $query->param("objectProduced"); + my $nameSpace = $query->param("nameSpace"); + my $serviceName = $query->param("serviceName"); + my $authURI = $query->param("authURI"); + my $sqlORalgor_rad = $query->param("sqlORalgor_rad"); + my $contactEmail = $query->param("contactEmail"); + my $description = $query->param("description"); + my $directory = $query->param("directory"); + my $outnameSpace = $query->param("outnameSpace"); + my $dbType = $query->param("dbType"); + my $dbInstance = $query->param("dbInstance"); + my $host_port = $query->param("host_port"); + my $username = $query->param("username"); + my $password1 = $query->param("password1"); + my $password2 = $query->param("password2"); + my $prefixed = $query->param("prefixed"); + my $genORcom = $query->param("genORcom"); + my $simORcollInput = $query->param("simORcollInput"); + my $simORcollOutput = $query->param("simORcollOutput"); + my $serviceCode = $query->param("sqlStatement"); + my $InputParam = $query->param("InputParam"); + + #Displaying the different input text boxes for user to type the names of parameters + + for(my $s=0; $s<$InputParam;$s++){ + push(@InParam, "") if (!$InParam[$s]); + } + + my @object_articles_opts = mygetArticles($objectConsumed); + my $articles_length = @object_articles_opts; + + #Displaying all the field, id and article names, in a selection box in the right column of the table for mapping purpose + my $object_articles_html; + foreach my $object_article_option (@object_articles_opts) + { + $object_articles_html .= ""; + $articles_length += 1; + + my $InputParam_html = ""; + for(my $i=0; $i<$InputParam;$i++){ + my $s = $i + 1; + $InputParam_html .= " Parameters $s: + + +"; + } + my $UI_string = UI_template("2"); + +print < +

    Mapping your SQL columns with MOBY Object Articles

    + For SQL Service, you are required to associate each column in your SQL statement with the corrosponding MOBY object article. Once you have mapped out each column with an article click on the 'Next' button to continue. +
    +

    $error_msg

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + $InputParam_html +
    SQL Variable Name
    Moby Object Article
    +
    +
    + + + + +MAP + +} + +#****************************************************************************** +# This Function get the output column of a SQL query using pattern Matching +# ARGS: A String of SQL query +# Return: An Array of output Column Names +#****************************************************************************** +sub outMap{ + + my $code = shift; + my @list; + $code =~ s/\n//g; #remove all the new line symbol + $code =~ s/select|from.*|,//ig; #remove all un-needed information + $code =~ s/\./_/g; + + while($code =~ m/(\w+)/g){ + push(@list,$1); + } + return @list; +} + #********************************************************************************************************* # # In this form we will be associating the fields in the SQL query with the MobyObject @@ -950,20 +1087,14 @@ $column_html .= ""; $column_html .= ""; } + my $UI_string = UI_template("2"); print < - - MOBY-S Web Service Auto-Generator - SQL MAPPER - - - -
    -

    Mapping your SQL columns with MOBY Object Articles

    -

     

    - - Because you have selected your service to be an SQL service, you are required to associate each column in your SQL statement with the corrosponding MOBY object article.
    - Once you have mapped out each column with an article click on the 'Next' button to continue. + $UI_string + +

    Mapping your SQL columns with MOBY Object Articles

    + Please associate each column in your SQL statement with the corrosponding output MOBY object article. Once you have mapped out each column with an article click on the 'Next' button to continue. +
    @@ -1014,92 +1145,14 @@ } -#***************************************************************************** -# -# name: mygetArticles -# description: FUNCTION THAT GETS THE ARTICLES GIVEN AN OBJECT NAME, the URL returns an XML and it is parsed to get the articles -# args: objectProduced -# returns: an array with the elements being each article in the mobyObject -# -#***************************************************************************** -sub mygetArticles -{ - my $objectProduced = shift; - - my $URL = 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY_display_object_xml.cgi?obj=' . $objectProduced; - - my $XML = get $URL; - die "Couldn't get to $URL" unless defined $XML; - - $XML =~ s/\n//g; - $XML =~ s/> parse($XML) or die "Could not parse"; - - #Gets the parameter - #my ($theNode) = @_; - - my @articles; - #the first Node is #document - my $nodeList = $theNode->getChildNodes(); #nodeList is an object reference of the childnodes - my $length = $nodeList->getLength; #number of children - - # $node is actually the moby object type, eg. Go_term - # we now assign the new current node to that. - my $node = $nodeList->item(0); - - # We need to get the number of children this node has, because these are the elements/properties of the mobby object - my $objectLength = $node->getChildNodes->getLength; - #We also need to get the childNodes of the current node, which are the tags, such as "String" for articleName "Term" - my $newNodeList = $node->getChildNodes; - - #Using a for loop we have to go thru each element of the object - for (my $i=0; $i<$objectLength; $i++) - { - my $newNode = $newNodeList->item($i); - - #within each element there are attributes, which include the namespace, id and articlename - my $attLength; #This is the length of the attributes in the element - my $attList = $newNode->getAttributes; #gets the list of attributes in the element - - #check if are attributes - if( $attList ) - { - #assign the attribute length if there are attributes - $attLength = $attList->getLength; - } - if( $attLength) - { - #We go thru each attribute and only get the articleName - for( my $i=0; $i<$attLength; $i++) - { - my $attnode = $attList->item($i); - if ($attnode->getName eq "articleName") - { - push(@articles, $attnode->getValue); - } - } - } - } - - return @articles; -} - - #******************************************************************* # # THIS FUNCTION GENERATES THE DISPATCHER FOR THE SERVICE # - Currently there are two implementations of saving the dispatcher -# 1) Click on the "Save Dispatcher To" will open the save as window and the user will need to rename the file to dispatcher.cgi -# 2) Click on the "Save Dispatcher To (as name)" will also open the save as window, but the name is already entered -# - Obviously the second implementation is better than the first one, but we cannot use this idea when saving the actual webservice code, since +# Click on the "Save Dispatcher To" will open the save as window and the user will need to rename the file to dispatcher.cgi # the name of the file should be the name of the service # #******************************************************************* - sub generate_dispatcher{ my $error_msg = shift; @@ -1170,20 +1223,20 @@ } else{ - if($htmlORcom eq "htmlWrapper"){ + if($htmlORcom eq "htmlWrapper"){ #need to keep passing the Default Values for HTML Wrapper Input Mapping for(my $i=1;$i <= $DV_count;$i++){ $temp = $query->param("DValue$i"); $parse_html .= ""; } } + #Algorithm Output Mapping $temp2 = $query->param("outputobject_articles0"); $parse_html .= ""; } + my $UI_string = UI_template("4"); print < - - MOBY-S Web Service Auto-Generator - Dispatcher File + $UI_string - - - +
    -

    Dispatcher File +

    Dispatcher File

    -

     

    This is the dispatcher for your service, it is required during registation. Check over the code and make any changes if needed. Once you the code is correct click on the "Save As Dispatcher" button and save this file as 'dispatcher.cgi' and save it into the directory of your service.

    $error_msg @@ -1243,12 +1293,11 @@ -
    -
    +
    Click on the "Save Dispatcher To" button and save the file as "dispatcher.cgi" to the directory where you will be installing your webservice.
    eg. c:/tomcat/webapps/ROOT/WEB-INF/cgi/dispatcher.cgi

    Once you have saved the dispatcher onto your local computer, enter the URL of your dispatcher saved on your webserver. This URL is used during registation. -
    -