From gordonp at dev.open-bio.org Thu Nov 1 10:27:10 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 1 Nov 2007 10:27:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200711011427.lA1ERAwj031837@dev.open-bio.org> gordonp Thu Nov 1 10:27:10 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv31801/src/main/org/biomoby/shared Modified Files: MobyDataType.java Log Message: Fixed registry propagation moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/08/24 09:35:27 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/01 14:27:10 1.20 @@ -284,7 +284,7 @@ public MobyDataType getParent(){ String parentName = getParentName(); - return parentName == null || parentName.length() == 0 ? null : getDataType(parentName); + return parentName == null || parentName.length() == 0 ? null : getDataType(parentName, getRegistry()); } /** From mwilkinson at dev.open-bio.org Wed Nov 7 12:09:24 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 7 Nov 2007 12:09:24 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711071709.lA7H9Oaf014965@dev.open-bio.org> mwilkinson Wed Nov 7 12:09:23 EST 2007 Update of /home/repository/moby/moby-live/Docs In directory dev.open-bio.org:/tmp/cvs-serv14946 Modified Files: BioMoby_After_Review.pdf Log Message: updating the CVS version of the rejected manuscript. moby-live/Docs BioMoby_After_Review.pdf,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 Binary files /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf 2007/08/03 21:52:21 1.1 and /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf 2007/11/07 17:09:23 1.2 differ rcsdiff: /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf: diff failed From kawas at dev.open-bio.org Wed Nov 7 13:04:56 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 Nov 2007 13:04:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711071804.lA7I4uvI015058@dev.open-bio.org> kawas Wed Nov 7 13:04:55 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv15023 Modified Files: MobyMetadataResolver.pm Log Message: updated this module to include a getData call for service instances. Should probably move it to a different module considering the name of the this module suggests methods for metadata resolution moby-live/Perl/MOBY/lsid/authority MobyMetadataResolver.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/lsid/authority/MobyMetadataResolver.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/lsid/authority/MobyMetadataResolver.pm 2007/07/17 17:25:39 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/lsid/authority/MobyMetadataResolver.pm 2007/11/07 18:04:55 1.2 @@ -654,7 +654,8 @@ use LS::ID; use LS::Service::Response; use LS::Service::Fault; - +use MOBY::Client::Service; +use MOBY::Client::Central; use MOBY::Config; use MOBY::RDF::Ontologies::Services; @@ -704,6 +705,102 @@ } #----------------------------------------------------------------- +# getData +#----------------------------------------------------------------- + +=head2 getData + +This subroutine is the handler that actually performs +the action when getData is called on an LSID under this namespace + +This routine has 2 parameters: + lsid - the LSID + format - output format + + Example: getData(LS::ID->new('urn:lsid:authority:namespace:object')); + +A LS::Service::Response is returned if getData is successful. + +=cut + +sub getData { + + my ( $self, $lsid, $format ) = @_; + $lsid = $lsid->canonical(); + my $length = length( $lsid->object() ); + + # some error conditions + return LS::Service::Fault->fault('malformed LSID') unless $length > 0; + return LS::Service::Fault->fault('malformed LSID') + unless index( $lsid->object(), ',' ) > 0; + + my $servicename = + substr( $lsid->object(), index( $lsid->object(), ',' ) + 1, $length ); + my $authURI = substr( $lsid->object(), 0, index( $lsid->object(), ',' ) ); + + return LS::Service::Fault->fault('Unknown LSID') + unless ( + $self->lsidExists( + $lsid->namespace, $lsid->object, $lsid->revision + ) + ); + + my $latest = + $self->isLatest( $lsid->namespace, $lsid->object, + $lsid->revision ); + do { + my $data = MOBY::RDF::Ontologies::Services->new; + $format = 'application/xml' if ( !$format ); + my $wsdl = $self->_getServiceWSDL($authURI, $servicename); + print STDERR $wsdl; + return LS::Service::Response->new( + response => $wsdl, + format => $format + ); + } unless $latest; + + return LS::Service::Fault->serverFault( 'Unable to load Data', 600 ) + if ( $latest eq "" ); + + $format = 'text/plain'; + return LS::Service::Response->new( + response => "", + format => $format + ); + + +} +#----------------------------------------------------------------- +# _getServiceWSDL +#----------------------------------------------------------------- + +=head2 _getServiceWSDL + +This subroutine obtains the wsdl for moby services given the name/auth +combination. It uses the registry that is set in the enviroment. +TODO - might have to change this behaviour, if we think of a good +reason! + +=cut + +sub _getServiceWSDL { + my ( $self, $authority, $servicename ) = @_; + my $moby = MOBY::Client::Central->new(); + my ( $services, $RegObject ) = $moby->findService( + authURI => $authority, + serviceName => $servicename + ); + unless ($services && @{$services}[0] ) { + return ""; + }; + # should only be one ... + foreach my $ServiceInstance ( @{ $services } ) { + return $moby->retrieveService($ServiceInstance); + } + return "" +} + +#----------------------------------------------------------------- # getMetadata #----------------------------------------------------------------- From kawas at dev.open-bio.org Wed Nov 7 13:06:38 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 Nov 2007 13:06:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711071806.lA7I6cmn015101@dev.open-bio.org> kawas Wed Nov 7 13:06:38 EST 2007 Update of /home/repository/moby/moby-live/Perl/scripts In directory dev.open-bio.org:/tmp/cvs-serv15066 Modified Files: authority.pl Log Message: added code to allow for the data resolution of service instances moby-live/Perl/scripts authority.pl,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/authority.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/scripts/authority.pl 2007/08/14 23:28:09 1.2 +++ /home/repository/moby/moby-live/Perl/scripts/authority.pl 2007/11/07 18:06:38 1.3 @@ -1,167 +1,185 @@ -#!/usr/bin/perl -w -#----------------------------------------------------------------- -# authority.pl -# Author: Edward Kawas , -# For copyright and disclaimer see below. -# -# $Id$ -#----------------------------------------------------------------- - -use strict; -use warnings; - -use MOBY::lsid::authority::MobyMetadataResolver; - -use LS::ID; - -use LS::Service::Fault; -use LS::Service::Response; -use LS::Service::Authority; -use LS::Service::Namespace; -use LS::Service::DataService; -use LS::Service::AdvancedDataService; - -use LS::HTTP::Service; -use LS::RDF::SimpleDocument; - -# -# The SOAP service will travel over HTTP to this mod_perl based -# authority where all of the SOAP messages are decoded and -# passed up the SOAP stack until they reach this framework -# -# UNTESTED: The package defaults to HTTP:CGI which works in most -# cases. -# -#use LS::SOAP::Service transport=> 'HTTP::Apache'; -use LS::SOAP::Service transport => 'HTTP::CGI'; - -############## - -my $location = 'http://'; - -# TODO get this from the mobyconfig file -if ( $ENV{'HTTP_HOST'} ) { - - $location .= $ENV{'HTTP_HOST'}; -} -else { - - # Set this to the default hostname for the authority - $location .= 'localhost:8080'; -} - -# Create the authority service -my $authority = LS::Service::Authority->new( - name => 'BioMOBY', - authority => 'biomoby.org', - location => $location, - getAvailableServices => \&dynamic_ops -); - -# -# Add two ports to the authority: -# -# 1. A HTTP Location for the metadata -# -# 2. A SOAP location for the metadata -# - -my $port; - -$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( - portName=> 'BioMOBYSoapPort', - endpoint=> "$location/authority/metadata", - protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP, - ); -$authority->addPort(serviceName=> 'BioMOBY', port=> $port); - -$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( - portName=> 'BioMOBYHttpPort', - endpoint=> "$location/authority/metadata", - protocol=> $LS::Authority::WSDL::Constants::Protocols::HTTP, - ); -$authority->addPort(serviceName=> 'BioMOBY', port=> $port); - - - -# Add the metadata service with namespaces - -# we will handle 4 namespaces ... namespacetype, serviceinstance, servicetype and objectclass. -#TODO add the other predicates ... -my $metadata = LS::Service::DataService->new(); -$metadata->addNamespace( MobyNamespaceType->new() ); -$metadata->addNamespace( MobyServiceInstance->new() ); -$metadata->addNamespace( MobyServiceType->new() ); -$metadata->addNamespace( MobyObjectClass->new() ); - -my $moby_authority_service = LS::SOAP::Service->new(); - -$moby_authority_service->metadata_service($metadata); -$moby_authority_service->data_service($metadata); -$moby_authority_service->authority_service($authority); - -# -# Create a HTTP service and instruct the SOAP service to -# accept HTTP queries -# -my $moby_http_service = LS::HTTP::Service->new(); -$moby_http_service->dispatch_authority_to($authority); -$moby_http_service->dispatch_metadata_to($metadata); - -$moby_authority_service->http_server($moby_http_service); - -$moby_authority_service->dispatch(); - -# -# This adds a HTTP/CGI metadata port to the returned WSDL for each valid -# LSID -# -sub dynamic_ops { - -# if the namespace is serviceinstance, get the signatureURL and add it as a location - my ( $lsid, $wsdl ) = @_; - my %valid_namespaces = ( - "namespacetype" => 1, - "serviceinstance" => 1, - "objectclass" => 1, - "servicetype" => 1 - ); - my $namespace = $lsid->namespace(); - my $object = $lsid->object(); - - return LS::Service::Fault->fault('Unknown LSID') - unless ( $valid_namespaces{$namespace} ); - -# need to decide whether or not i should check exisitence here as well as in the MobyMetadataResolver.pm ... - my $port; - - do { - my $length = length($object); - # some error conditions - if ( $length > 0 and index( $object, ',' ) > 0 ) { - my $servicename = - substr( $object, index( $object, ',' ) + 1, $length ); - my $authURI = substr( $object, 0, index( $object, ',' ) ); - - my $moby = MOBY::Client::Central->new(); - my ( $services, $RegObject ) = $moby->findService( - authURI => $authURI, - serviceName => $servicename - ); - foreach my $SI (@$services) { - #should only be one of them ... - $port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( - portName => 'HTTPMetadata', - endpoint => $SI->signatureURL, - protocol => $LS::Authority::WSDL::Constants::Protocols::HTTP, - ); - $wsdl->addPort( - serviceName => 'ServiceProviderMetadataHTTPPort', - port => $port - ); - } - } - } if ( $namespace eq 'serviceinstance' ); - return $wsdl; -} -__END__ +#!/usr/bin/perl -w +#----------------------------------------------------------------- +# authority.pl +# Author: Edward Kawas , +# For copyright and disclaimer see below. +# +# $Id$ +#----------------------------------------------------------------- + +use strict; +use warnings; + +use MOBY::lsid::authority::MobyMetadataResolver; + +use LS::ID; + +use LS::Service::Fault; +use LS::Service::Response; +use LS::Service::Authority; +use LS::Service::Namespace; +use LS::Service::DataService; +use LS::Service::AdvancedDataService; + +use LS::HTTP::Service; +use LS::RDF::SimpleDocument; + +# +# The SOAP service will travel over HTTP to this mod_perl based +# authority where all of the SOAP messages are decoded and +# passed up the SOAP stack until they reach this framework +# +# UNTESTED: The package defaults to HTTP:CGI which works in most +# cases. +# +#use LS::SOAP::Service transport=> 'HTTP::Apache'; +use LS::SOAP::Service transport => 'HTTP::CGI'; + +############## + +my $location = 'http://'; + +# TODO get this from the mobyconfig file +if ( $ENV{'HTTP_HOST'} ) { + + $location .= $ENV{'HTTP_HOST'}; +} +else { + + # Set this to the default hostname for the authority + $location .= 'localhost:8080'; +} + +# Create the authority service +my $authority = LS::Service::Authority->new( + name => 'BioMOBY', + authority => 'biomoby.org', + location => $location, + getAvailableServices => \&dynamic_ops +); + +# +# Add two ports to the authority: +# +# 1. A HTTP Location for the metadata +# +# 2. A SOAP location for the metadata +# +# 3. A HTTP Location for the data +# +# 4. A SOAP location for the data +# + +my $port; + +$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( + portName=> 'BioMOBYSoapPort', + endpoint=> "$location/authority/metadata", + protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP, + ); +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); + +$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( + portName=> 'BioMOBYHttpPort', + endpoint=> "$location/authority/metadata", + protocol=> $LS::Authority::WSDL::Constants::Protocols::HTTP, + ); +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); + +#data ports +$port = LS::Authority::WSDL::Simple::DataPort->newData( + portName=> 'BioMOBYHttpPort', + endpoint=> "$location/authority/data", + protocol=> $LS::Authority::WSDL::Constants::Protocols::HTTP, + ); + +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); +$port = LS::Authority::WSDL::Simple::DataPort->newData( + portName=> 'BioMOBYSoapPort', + endpoint=> "$location/authority/data", + protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP, + ); +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); + + +# Add the metadata service with namespaces + +# we will handle 4 namespaces ... namespacetype, serviceinstance, servicetype and objectclass. +#TODO add the other predicates ... +my $metadata = LS::Service::DataService->new(); +$metadata->addNamespace( MobyNamespaceType->new() ); +$metadata->addNamespace( MobyServiceInstance->new() ); +$metadata->addNamespace( MobyServiceType->new() ); +$metadata->addNamespace( MobyObjectClass->new() ); + +my $moby_authority_service = LS::SOAP::Service->new(); + +$moby_authority_service->metadata_service($metadata); +$moby_authority_service->data_service($metadata); +$moby_authority_service->authority_service($authority); + +# +# Create a HTTP service and instruct the SOAP service to +# accept HTTP queries +# +my $moby_http_service = LS::HTTP::Service->new(); +$moby_http_service->dispatch_authority_to($authority); +$moby_http_service->dispatch_metadata_to($metadata); + +$moby_authority_service->http_server($moby_http_service); + +$moby_authority_service->dispatch(); + +# +# This adds a HTTP/CGI metadata port to the returned WSDL for each valid +# LSID +# +sub dynamic_ops { + +# if the namespace is serviceinstance, get the signatureURL and add it as a location + my ( $lsid, $wsdl ) = @_; + my %valid_namespaces = ( + "namespacetype" => 1, + "serviceinstance" => 1, + "objectclass" => 1, + "servicetype" => 1 + ); + my $namespace = $lsid->namespace(); + my $object = $lsid->object(); + + return LS::Service::Fault->fault('Unknown LSID') + unless ( $valid_namespaces{$namespace} ); + +# need to decide whether or not i should check exisitence here as well as in the MobyMetadataResolver.pm ... + my $port; + + do { + my $length = length($object); + # some error conditions + if ( $length > 0 and index( $object, ',' ) > 0 ) { + my $servicename = + substr( $object, index( $object, ',' ) + 1, $length ); + my $authURI = substr( $object, 0, index( $object, ',' ) ); + + my $moby = MOBY::Client::Central->new(); + my ( $services, $RegObject ) = $moby->findService( + authURI => $authURI, + serviceName => $servicename + ); + foreach my $SI (@$services) { + #should only be one of them ... + $port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( + portName => 'HTTPMetadata', + endpoint => $SI->signatureURL, + protocol => $LS::Authority::WSDL::Constants::Protocols::HTTP, + ); + $wsdl->addPort( + serviceName => 'ServiceProviderMetadataHTTPPort', + port => $port + ); + } + } + } if ( $namespace eq 'serviceinstance' ); + return $wsdl; +} +__END__ From pieter at dev.open-bio.org Wed Nov 21 11:29:19 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Wed, 21 Nov 2007 11:29:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711211629.lALGTJDm031739@dev.open-bio.org> pieter Wed Nov 21 11:29:18 EST 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv31692 Modified Files: InformationBlocks.html MessageStructure.html MobyCentralObjects.html XMLPayloads.html Added Files: Authorities.html Log Message: Added documentation on Authorities and their URIs. moby-live/Docs/MOBY-S_API Authorities.html,NONE,1.1 InformationBlocks.html,1.8,1.9 MessageStructure.html,1.11,1.12 MobyCentralObjects.html,1.10,1.11 XMLPayloads.html,1.20,1.21 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/InformationBlocks.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/InformationBlocks.html 2007/02/22 16:22:24 1.8 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/InformationBlocks.html 2007/11/21 16:29:18 1.9 @@ -105,13 +105,13 @@
  • id: This is the ID within that namespace (as in the base Object)
  • -
  • authURI: the Authority of a service provider who can execute an +
  • authURI: the Authority of a service provider who can execute an appropriate service on the piece of data referred to by this cross-reference such that the intent of the cross-reference will be realized.
  • serviceName: the name of the MOBY Service provided by that -Authority that does the appropriate transaction.
  • +Authority that does the appropriate transaction.
  • xrefType: a term indicating the semantic type of this cross-reference.
  • @@ -129,7 +129,8 @@

    All components are required, with the exception of the human readable description. The namespace and id attributes fulfil the same role as -their counterparts in the Object style cross-reference. The authURI +their counterparts in the Object style cross-reference. +The authURI and serviceName components together act as a unique identifier to a particular MOBY Service that the current service provider suggests you execute using this cross-reference (namespace/id) in order to =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MessageStructure.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MessageStructure.html 2006/11/21 23:04:27 1.11 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MessageStructure.html 2007/11/21 16:29:18 1.12 @@ -84,8 +84,8 @@

    -This is regardless of the URI for the service provider! This is -useful because the same service might be available from several +This is regardless of the URI for the service provider! +This is useful because the same service might be available from several providers. If they all use the same URI, then a computer (or human) can infer that they are equivalent, and swap one for the other, based on availability, or other criteria. @@ -107,7 +107,7 @@ <Category>moby</Category> <serviceName>retrieveSequence</serviceName> <serviceType>Retrieve</serviceType> - <authURI>services.serviceprovider.org</authURI> + <authURI>services.serviceprovider.org</authURI> <URL>http://serviceprovider.org/getService.pl</URL>; <contactEmail>markw at illuminae.com</contactEmail> <authoritativeService>0</authoritativeService> =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2007/02/22 16:22:24 1.10 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2007/11/21 16:29:18 1.11 @@ -94,7 +94,7 @@ To query MOBY Central, you fill out the relevant elements of a Query Ojbect. These include the input and/or output data Classes (by name from the Class ontology), the Service-type (by name from the -Service-type ontology), the authority (service provider URI), or any +Service-type ontology), the authority (service provider URI), or any number of keywords that must appear in the service description.

      @@ -167,7 +167,7 @@ </outputObjects> <serviceType>ServiceTypeTerm</serviceType> <Category>moby</Category> - <authURI>desired.service.provider</authURI> + <authURI>desired.service.provider</authURI> <signatureURL>http://location.to/service/description</signatureURL> <serviceName>MyServiceName</serviceName>; <expandObjects>1|0</expandObjects> @@ -194,7 +194,7 @@
        <Services>
      -   <Service authURI="authority.URI.here" serviceName="MyService" 
      +   <Service authURI="authority.URI.here" serviceName="MyService" 
       	         lsid='urn:lsid:authority.uri:serviceinstance:id'>
            <serviceType lsid='urn:lsid:authority.uri:servicetype:OntologyTerm'>
       	       Ontology_Term
      @@ -220,9 +220,9 @@
        </Services>
       
      -The "Service" XML element, contains the attributes of authority URI +The "Service" XML element, contains the attributes of authority URI (authURI), service name (serviceName), and the LSID representing the -service instance; the combination of authURI and serviceName is +service instance; the combination of authURI and serviceName is sufficient to unambiguously describe any MOBY service instance in a MOBY Central registry. Thus these are used to retrieve the service definition using the MOBY Central retrieveService procedure =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/XMLPayloads.html,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/XMLPayloads.html 2007/06/07 15:30:01 1.20 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/XMLPayloads.html 2007/11/21 16:29:18 1.21 @@ -242,7 +242,7 @@ currently only 'moby' services are fully supported --> <serviceName>YourServiceNameHere</serviceName> <serviceType>TypeOntologyTerm</serviceType> - <authURI>your.URI.here</authURI> + <authURI>your.URI.here</authURI> <signatureURL> http://some.URL.org/path/to/RDF/file </signatureURL> <URL>http://URL.to.your/Service.script</URL>; <contactEmail>your_name at contact.address.com</contactEmail> @@ -293,11 +293,11 @@
      • If that RDF document contains a new Signature RDF, that new service (if valid) will be registered
        • -
        • An new service is recognized by the presence of a novel authorityURI + serviceName (predicates dc:publisher and mygrid:hasServiceNameText) in a mygrid:serviceDescription block of the Signature RDF document
        • +
        • An new service is recognized by the presence of a novel authorityURI + serviceName (predicates dc:publisher and mygrid:hasServiceNameText) in a mygrid:serviceDescription block of the Signature RDF document
      • If the retrieved RDF document contains a modified Signature RDF, the currently-registered service will be updated in MOBY Central
        • -
        • An updated service is recognized by the presence of a known authorityURI + serviceName in a Signature RDF service description, where other parameters have been altered compared to what is in the MOBY Central registry
        • +
        • An updated service is recognized by the presence of a known authorityURI + serviceName in a Signature RDF service description, where other parameters have been altered compared to what is in the MOBY Central registry
        • uncertain: the Agent will refuse to modify the service if you do not also modify your service's LSID.
      • If a Signature RDF is missing from the document, the service formerly described by that RDF will be deregistered from MOBY Central
      • @@ -381,7 +381,7 @@

        Input XML

                 <retrieveService>
        -            <Service authURI="authority.URI.here" serviceName="MyService"/>          
        +            <Service authURI="your.URI.here" serviceName="MyService"/>          
                 </retrieveService>
         
        @@ -390,7 +390,7 @@
        • moby
          -         <Service authURI="authority.URI.here" serviceName="MyService" 
          +         <Service authURI="your.URI.here" serviceName="MyService" 
           	 lsid='urn:lsid:authority.uri:serviceinstance:id'>
                         <![CDATA[WSDL document here]]>
                    </Service>
          @@ -420,7 +420,7 @@
           

          Notes

            -
          • AuthURI and serviceName attributes are +
          • authURI and serviceName attributes are sufficient to identify a unique service, and both are required in the element.
          • @@ -450,7 +450,7 @@

            Output XML

                     <serviceProviders>
            -           <serviceProvider name="authority.URI.here"/>
            +           <serviceProvider name="your.URI.here"/>
                             ...
                     </serviceProviders>
             
            @@ -483,7 +483,7 @@

            Output XML

                     <serviceNames>
            -           <serviceName name="serviceName" authURI='authority.info.here' 
            +           <serviceName name="serviceName" authURI="your.URI.here" 
             	   lsid='urn:lsid:authority.uri:namespace:id'/>
                             ...
                     </serviceNames>
            @@ -492,9 +492,9 @@
             
            • Retrieves minimal information about all registered MOBY services
              • -
              • serviceName -
              • authority -
              • service instance LSID +
              • Name
              • +
              • Authority
              • +
              • LSID
            @@ -509,7 +509,7 @@ <serviceType name="serviceName" lsid='urn:lsid:authority.uri:servicetype:id'> <Description><![CDATA[free text description here]]></Description> <contactEmail>email at address here</contactEmail> - <authURI>authority.uri.here</authURI> + <authURI>your.URI.here</authURI> </serviceType> ... </serviceTypes> @@ -575,7 +575,7 @@ <objectType articleName="SomeName" lsid='urn:lsid:authority.uri:namespace:id'>ExistingObjectType</objectType> </Relationship> ... - <authURI>owner.URI.here</authURI> + <authURI>your.URI.here</authURI> <contactEmail>owner at their.address.com</contactEmail> </retrieveObjectDefinition>
            @@ -596,7 +596,7 @@ <Namespace name="namespace" lsid='urn:lsid:authority.uri:namespace:id'> <Description><![CDATA[free text description here]]></Description> <contactEmail>email at address here</contactEmail> - <authURI>authority.uri.here</authURI> + <authURI>your.URI.here</authURI> </Namespace> ... </Namespaces> @@ -743,7 +743,7 @@ ... </Relationship> ... - <authURI>Your.URI.here</authURI> + <authURI>your.URI.here</authURI> <contactEmail>You at your.address.com</contactEmail> </registerObjectClass>
          @@ -825,7 +825,7 @@ <registerServiceType> <serviceType>NewServiceType</serviceType> <contactEmail>your_name at contact.address.com</contactEmail> - <authURI>Your.URI.here</authURI> + <authURI>your.URI.here</authURI> <Description> <![CDATA[ human description of service type here]]> </Description> @@ -891,7 +891,7 @@ <registerNamespace> <namespaceType>NewNamespaceHere</namespaceType> <contactEmail>your_name at contact.address.com</contactEmail> - <authURI>Your.URI.here</authURI> + <authURI>your.URI.here</authURI> <Description> <![CDATA[human readable description]]> </Description> From pieter at dev.open-bio.org Thu Nov 22 12:42:38 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Thu, 22 Nov 2007 12:42:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711221742.lAMHgcsA004564@dev.open-bio.org> pieter Thu Nov 22 12:42:37 EST 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv4529 Modified Files: Authorities.html Log Message: fixed erroneous relative links in Authorities.html moby-live/Docs/MOBY-S_API Authorities.html,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/Authorities.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/Authorities.html 2007/11/21 16:29:18 1.1 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/Authorities.html 2007/11/22 17:42:37 1.2 @@ -153,53 +153,52 @@

          Other parts of MOBY-S API

        • Categories

          @@ -225,7 +224,8 @@
        • Meta

        • From kawas at dev.open-bio.org Mon Nov 26 17:49:04 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 26 Nov 2007 17:49:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262249.lAQMn4Sc018150@dev.open-bio.org> kawas Mon Nov 26 17:49:03 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv18115/RDF/Ontologies Modified Files: Services.pm Log Message: split up findservice calls that want all services into many calls by service provider. moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/08/23 17:48:28 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/26 22:49:03 1.5 @@ -118,10 +118,24 @@ my $authURI = $hash->{authURI} || ''; my $name = $hash->{serviceName} || ''; my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; + my $services = []; + my $RegObject; + + if ($name ne '' or $authURI ne '') { + my $moby = MOBY::Client::Central->new(); + ( $services, $RegObject ) = + $moby->findService( authURI => $authURI, serviceName => $name ); + + } else { + my $moby = MOBY::Client::Central->new(); + my ( @URIS ) = $moby->retrieveServiceProviders(); + foreach my $provider (@URIS) { + my ( $instances, $RegObject ) = + $moby->findService( authURI => $provider ); + push @$services, @$instances; + } - my $moby = MOBY::Client::Central->new(); - my ( $services, $RegObject ) = - $moby->findService( authURI => $authURI, serviceName => $name ); + } my $xml = $self->_createRDFModel( \@$services ); return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) unless $prettyPrint eq 'no'; From mwilkinson at dev.open-bio.org Mon Nov 26 18:00:35 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 26 Nov 2007 18:00:35 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262300.lAQN0Zg7018279@dev.open-bio.org> mwilkinson Mon Nov 26 18:00:35 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv18260/MOBY Modified Files: Central.pm Log Message: Perl code now scraping current location of default MOBY Central from the 301 Redirect headers from biomoby.org moby-live/Perl/MOBY Central.pm,1.292,1.293 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.292 retrieving revision 1.293 diff -u -r1.292 -r1.293 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/10/22 20:52:56 1.292 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/11/26 23:00:35 1.293 @@ -96,7 +96,7 @@ CLIENT-SIDE use SOAP::Lite +autodispatch => - proxy => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', + proxy => 'http://moby.ucalgary.ca/moby/MOBY-Central.pl', # or whatever... on_fault => sub { my($soap, $res) = @_; die ref $res ? $res->faultstring : $soap->transport->status, "\n"; From mwilkinson at dev.open-bio.org Mon Nov 26 18:00:36 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 26 Nov 2007 18:00:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262300.lAQN0ak2018305@dev.open-bio.org> mwilkinson Mon Nov 26 18:00:35 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv18260/MOBY/Client Modified Files: Central.pm OntologyServer.pm Log Message: Perl code now scraping current location of default MOBY Central from the 301 Redirect headers from biomoby.org moby-live/Perl/MOBY/Client Central.pm,1.152,1.153 OntologyServer.pm,1.17,1.18 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.152 retrieving revision 1.153 diff -u -r1.152 -r1.153 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/09/14 17:23:47 1.152 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/11/26 23:00:35 1.153 @@ -143,12 +143,8 @@ ( Connections => [ undef, 'read/write' ], default_MOBY_servername => [ 'mobycentral', 'read/write' ], - default_MOBY_server => [ -'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', - 'read/write' - ], - default_MOBY_uri => - [ 'http://mobycentral.icapture.ubc.ca/MOBY/Central', 'read/write' ], + default_MOBY_server => [ '', 'read/write'], + default_MOBY_uri => [ 'http://biomoby.org/MOBY/Central', 'read/write' ], default_MOBY_proxy => [ undef, 'read/write' ], default_MOBY_type => [ 'soap', 'read/write' ], Registries => [ undef, 'read/write' ], @@ -263,7 +259,11 @@ } $self->Connections( [] ); # initialize; + my ($central, $ontologyserver) = _getDefaultCentral(); + $self->default_MOBY_server($central) if $central; + # if user has set up preferred servers, then use those by default + $self->default_MOBY_server( $ENV{MOBY_SERVER} ) if $ENV{MOBY_SERVER}; $self->default_MOBY_uri( $ENV{MOBY_URI} ) if $ENV{MOBY_URI}; $self->default_MOBY_type( $ENV{MOBY_TYPE} ) if $ENV{MOBY_TYPE}; @@ -358,6 +358,23 @@ return $self; } + +sub _getDefaultCentral { + + use LWP::UserAgent; + use HTTP::Request::Common qw(HEAD); + + my $ua = LWP::UserAgent->new; + my $req = HEAD 'http://biomoby.org/mobycentral'; + my $res = $ua->simple_request($req); + my $mobycentral = $res->header('location'); + + $req = HEAD 'http://biomoby.org/ontologyserver'; + $res = $ua->simple_request($req); + my $ontologyserver = $res->header('location'); + return ($mobycentral, $ontologyserver); +} + =head2 registerObject a.k.a registerObjectClass Usage : $REG = $MOBY->registerObject(%args) =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:15:13 1.17 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/11/26 23:00:35 1.18 @@ -85,10 +85,7 @@ #ATTRIBUTES my %_attr_data = # DEFAULT ACCESSIBILITY ( - host => [ - "http://mobycentral.icapture.ubc.ca/cgi-bin/OntologyServer.cgi", - 'read/write' - ], + host => ['' ,'read/write'], proxy => [ undef, 'read/write' ], ); @@ -126,11 +123,24 @@ $self->{$attrname} = $self->_default_for( $attrname ); } } - $self->host($ENV{MOBY_ONTOLOGYSERVER}) if ($ENV{MOBY_ONTOLOGYSERVER}); + my ($ontologyserver) = _getOntologyServer(); # get default from moby central + $self->host($ontologyserver) if $ontologyserver; + $self->host($ENV{MOBY_ONTOLOGYSERVER}) if ($ENV{MOBY_ONTOLOGYSERVER}); # override with user preference if set in their environment return undef unless $self->host; return $self; } + +sub _getOntologyServer { + use LWP::UserAgent; + use HTTP::Request::Common qw(HEAD); + my $ua = LWP::UserAgent->new; + my $req = HEAD 'http://biomoby.org/ontologyserver'; + my $res = $ua->simple_request($req); + my $ontologyserver = $res->header('location'); + return $ontologyserver; +} + =head2 objectExists =cut From mwilkinson at dev.open-bio.org Mon Nov 26 18:16:23 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 26 Nov 2007 18:16:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262316.lAQNGNN6018421@dev.open-bio.org> mwilkinson Mon Nov 26 18:16:23 EST 2007 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv18398/t Modified Files: Client-OntologyServer.t Client-Central.t Log Message: make sure people know which regisry they are testing during the make test moby-live/Perl/t Client-OntologyServer.t,1.8,1.9 Client-Central.t,1.56,1.57 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2007/01/31 16:17:43 1.8 +++ /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2007/11/26 23:16:23 1.9 @@ -1,182 +1,182 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' - -# Note added by Frank Gibbons. -# Tests should, as far as possible, avoid the use of literals. -# If you register a service with authURI => mysite.com, -# and you want to test a retrieved description of the service, -# don't test that the service returns authURI eq "mysite.com", -# test so that it returns the same value as you used to register it in the first place. - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; -#use SOAP::Lite +trace; -use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details -use strict; -use MOBY::Client::OntologyServer; -use MOBY::Client::Central; -BEGIN { use_ok('MOBY::Client::OntologyServer'); - # initialize with a couple of useless things that we can guarantee to find - my $C = MOBY::Client::Central->new(); - - my %Namespace = ( namespaceType => 'Rub1', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - my $r = $C->registerNamespace( %Namespace ); - %Namespace = ( namespaceType => 'Rub2', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - $r = $C->registerNamespace( %Namespace ); - my %ServiceType = ( serviceType => "Rub1", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType ); - %ServiceType = ( serviceType => "Rub2", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType ); - }; - - -END { - # Define cleanup of registry, to return it to its 'pristine' state, - # so that later attempts to run tests don't run into problems caused - # by failure of these tests, or abortion of the test script. - # Reconnect to MOBY Central here, since other connections - # will have gone out of scope by the time we get to this END block. - # Also can't use %Obj, - my $C = MOBY::Client::Central->new(); - my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); - $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); - $r = $C->deregisterServiceType( serviceType => 'Rub1' ); - $r = $C->deregisterServiceType( serviceType => 'Rub2' ); - -}; - - -my @autoload = qw/host proxy/; -my @API = (@autoload, qw/new getUserAgent -objectExists serviceExists namespaceExists /); - -my $os = MOBY::Client::OntologyServer->new(); - -if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { - print STDERR <host,"\n\n\n"; -} - -foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. -can_ok("MOBY::Client::OntologyServer", @API) - or diag("OntologyServer doesn't implement full API"); - -# Check that accessor methods work correctly; -my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); -my ($new_host, $new_proxy) = ("foo.cgi", "bar"); -is($os->host($new_host), $new_host) or diag("Couldn't set new host"); -is($os->host(), $new_host) or diag("Couldn't get host"); -is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); - is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); - is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); -TODO: { - local $TODO = "How come I cant' set proxy back to its original value?"; - is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); -} - -# Start fresh.... -$os = MOBY::Client::OntologyServer->new(); - -my ($success, $msg, $existingURI); -my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid -foreach (@check_ns) { - ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); - is($success, 1) - or diag("Namespace '$_' reported erroneously as non-existent."); -} - -# Could get these allowed datatypes from MOBY::Config, -# except that module only works when you've got a local registry set up. -my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid -foreach (@check_obj) { - ($success, $msg, $existingURI) = $os->objectExists(term => $_); - is($success, 1) - or diag("Object '$_' reported erroneously as non-existent."); -} - -my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... -foreach (@check_servicetype) { - ($success, $msg, $existingURI) = $os->serviceExists(term => $_); - is($success, 1) - or diag("Service type '$_' reported erroneously as non-existent."); -} - -SKIP: { - skip "relationshipExists not implemented", 5 - unless MOBY::Client::OntologyServer->can("relationshipExists"); - - can_ok("MOBY::Client::OntologyServer", "relationshipExists") - or diag("OntologyServer should be able to tell whether a relationship exists"); - my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. - foreach (@check_rel) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. - foreach (@check_rel2) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - - my $invalid_rel = "HA"; - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); -} - - -######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### -# -# Literal invalid names are OK here, since there's no obvious way to generate them -# and guarantee that they'll be invalid. -# -my $invalid_ns = "InvalidNS"; -($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); -is($success, 0) - or diag("Namespace '$invalid_ns' reported erroneously as existent."); - -my $invalid_obj = "InvalidObject"; -($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); -is($success, 0) - or diag("Object '$invalid_obj' reported erroneously as existent."); - -my $invalid_st = "InvalidServiceType"; -($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); -is($success, 0) - or diag("Service type '$invalid_st' reported erroneously as existent."); - +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 1.t' + +# Note added by Frank Gibbons. +# Tests should, as far as possible, avoid the use of literals. +# If you register a service with authURI => mysite.com, +# and you want to test a retrieved description of the service, +# don't test that the service returns authURI eq "mysite.com", +# test so that it returns the same value as you used to register it in the first place. + +######################### + +# change 'tests => 1' to 'tests => last_test_to_print'; +#use SOAP::Lite +trace; +use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details +use strict; +use MOBY::Client::OntologyServer; +use MOBY::Client::Central; +BEGIN { use_ok('MOBY::Client::OntologyServer'); + # initialize with a couple of useless things that we can guarantee to find + my $C = MOBY::Client::Central->new(); + + my %Namespace = ( namespaceType => 'Rub1', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + my $r = $C->registerNamespace( %Namespace ); + %Namespace = ( namespaceType => 'Rub2', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + $r = $C->registerNamespace( %Namespace ); + my %ServiceType = ( serviceType => "Rub1", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + %ServiceType = ( serviceType => "Rub2", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + }; + + +END { + # Define cleanup of registry, to return it to its 'pristine' state, + # so that later attempts to run tests don't run into problems caused + # by failure of these tests, or abortion of the test script. + # Reconnect to MOBY Central here, since other connections + # will have gone out of scope by the time we get to this END block. + # Also can't use %Obj, + my $C = MOBY::Client::Central->new(); + my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); + $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); + $r = $C->deregisterServiceType( serviceType => 'Rub1' ); + $r = $C->deregisterServiceType( serviceType => 'Rub2' ); + +}; + + +my @autoload = qw/host proxy/; +my @API = (@autoload, qw/new getUserAgent +objectExists serviceExists namespaceExists /); + +my $os = MOBY::Client::OntologyServer->new(); +diag "\n\nUsing Ontology Server at: ", $os->host, "\n\n"; +if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { + print STDERR <host,"\n\n\n"; +} + +foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. +can_ok("MOBY::Client::OntologyServer", @API) + or diag("OntologyServer doesn't implement full API"); + +# Check that accessor methods work correctly; +my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); +my ($new_host, $new_proxy) = ("foo.cgi", "bar"); +is($os->host($new_host), $new_host) or diag("Couldn't set new host"); +is($os->host(), $new_host) or diag("Couldn't get host"); +is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); + is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); + is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); +TODO: { + local $TODO = "How come I cant' set proxy back to its original value?"; + is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); +} + +# Start fresh.... +$os = MOBY::Client::OntologyServer->new(); + +my ($success, $msg, $existingURI); +my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid +foreach (@check_ns) { + ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); + is($success, 1) + or diag("Namespace '$_' reported erroneously as non-existent."); +} + +# Could get these allowed datatypes from MOBY::Config, +# except that module only works when you've got a local registry set up. +my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid +foreach (@check_obj) { + ($success, $msg, $existingURI) = $os->objectExists(term => $_); + is($success, 1) + or diag("Object '$_' reported erroneously as non-existent."); +} + +my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... +foreach (@check_servicetype) { + ($success, $msg, $existingURI) = $os->serviceExists(term => $_); + is($success, 1) + or diag("Service type '$_' reported erroneously as non-existent."); +} + +SKIP: { + skip "relationshipExists not implemented", 5 + unless MOBY::Client::OntologyServer->can("relationshipExists"); + + can_ok("MOBY::Client::OntologyServer", "relationshipExists") + or diag("OntologyServer should be able to tell whether a relationship exists"); + my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. + foreach (@check_rel) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. + foreach (@check_rel2) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + + my $invalid_rel = "HA"; + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); +} + + +######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### +# +# Literal invalid names are OK here, since there's no obvious way to generate them +# and guarantee that they'll be invalid. +# +my $invalid_ns = "InvalidNS"; +($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); +is($success, 0) + or diag("Namespace '$invalid_ns' reported erroneously as existent."); + +my $invalid_obj = "InvalidObject"; +($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); +is($success, 0) + or diag("Object '$invalid_obj' reported erroneously as existent."); + +my $invalid_st = "InvalidServiceType"; +($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); +is($success, 0) + or diag("Service type '$invalid_st' reported erroneously as existent."); + =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2007/02/05 21:17:47 1.56 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2007/11/26 23:16:23 1.57 @@ -75,6 +75,7 @@ # Can we connect to the registry? my $C = MOBY::Client::Central->new(); +diag "\n\nUsing Moby Central located at: ", $C->default_MOBY_server, "\n\n"; isa_ok( $C, 'MOBY::Client::Central',"Connected to test MOBY Central") or die("Cannot Connect to MOBY Central... cannot continue?"); From kawas at dev.open-bio.org Wed Nov 28 14:58:43 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 14:58:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711281958.lASJwhPk027970@dev.open-bio.org> kawas Wed Nov 28 14:58:42 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv27935/RDF/Ontologies/Cache Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache added to the repository moby-live/Perl/MOBY/RDF/Ontologies/Cache - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/RCS/directory,v: No such file or directory From kawas at dev.open-bio.org Wed Nov 28 14:58:46 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 14:58:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711281958.lASJwkJ6028024@dev.open-bio.org> kawas Wed Nov 28 14:58:46 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv27993/RDF/Ontologies/Cache Added Files: ServiceCache.pm CacheUtils.pm Log Message: moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,NONE,1.1 CacheUtils.pm,NONE,1.1 From kawas at dev.open-bio.org Wed Nov 28 15:01:23 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 15:01:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711282001.lASK1NoQ028102@dev.open-bio.org> kawas Wed Nov 28 15:01:23 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv28067/RDF/Ontologies Modified Files: Services.pm Log Message: added parameters to the constructor. also, when getting all services, modified behaviour to make multiple api calls rather than one findservice call. moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/26 22:49:03 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/28 20:01:23 1.6 @@ -19,6 +19,7 @@ use XML::LibXML; use MOBY::Client::Central; +use MOBY::Config; use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::FETA; @@ -81,18 +82,26 @@ # new #----------------------------------------------------------------- sub new { - my ($class) = @_; + my ( $class, %args ) = @_; -#TODO - Extract the URIs for Namespaces/ServiceTypes/Objects/ServiceInstances from the moby config file -# create an object + # create an object my $self = bless {}, ref($class) || $class; - + # save some information retrieved from mobycentral.config - my $CONF = MOBY::Config->new; - $self->{uri} = $CONF->{mobycentral}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#'; + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobycentral}->{resourceURL} + || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#' unless (defined $args{uri} and $args{uri}); + + # save the endpoint/namespace/uri if passed in + $self->{endpoint} = $args{endpoint} if $args{endpoint}; + $self->{namespace} = $args{endpoint} if $args{namespace}; + $self->{uri} = $args{uri} if $args{uri} and defined $args{uri}; + + # add a # at the end of the uri if it isnt there already $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; $self->{is_alive_path} = $CONF->{mobycentral}->{service_tester_path}; + # done return $self; } @@ -120,20 +129,32 @@ my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; my $services = []; my $RegObject; - - if ($name ne '' or $authURI ne '') { - my $moby = MOBY::Client::Central->new(); + + # use the passed in endpoint if applicable + my $moby = MOBY::Client::Central->new( + Registries => { + mobycentral => { + URL => $self->{endpoint}, + URI => 'http://mobycentral.cbr.nrc.ca/MOBY/Central' + } + } + ) + if $self->{endpoint}; + + # otherwise use default one + $moby = MOBY::Client::Central->new() unless $self->{endpoint}; + + if ( $name ne '' or $authURI ne '' ) { ( $services, $RegObject ) = - $moby->findService( authURI => $authURI, serviceName => $name ); - + $moby->findService( authURI => $authURI, serviceName => $name ); + } else { - my $moby = MOBY::Client::Central->new(); - my ( @URIS ) = $moby->retrieveServiceProviders(); - foreach my $provider (@URIS) { - my ( $instances, $RegObject ) = - $moby->findService( authURI => $provider ); - push @$services, @$instances; - } + my (@URIS) = $moby->retrieveServiceProviders(); + foreach my $provider (@URIS) { + my ( $instances, $RegObject ) = + $moby->findService( authURI => $provider ); + push @$services, @$instances; + } } my $xml = $self->_createRDFModel( \@$services ); @@ -160,26 +181,26 @@ my $storage = new RDF::Core::Storage::Memory; my $model = new RDF::Core::Model( Storage => $storage ); my $node_factory = new RDF::Core::NodeFactory(); - + foreach my $SI (@$services) { my $resource = new RDF::Core::Resource( $self->{uri}, - $SI->authority . "," . $SI->name ); + $SI->authority . "," . $SI->name ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->serviceDescription - ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->serviceDescription + ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->format ), - new RDF::Core::Literal( $SI->category ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->format ), + new RDF::Core::Literal( $SI->category ) + ) ); $model->addStmt( new RDF::Core::Statement( @@ -189,257 +210,260 @@ ) ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->locationURI ), - new RDF::Core::Literal( $SI->URL ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::FETA->hasServiceDescriptionText - ), - new RDF::Core::Literal( $SI->description ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::FETA->hasServiceDescriptionLocation - ), - new RDF::Core::Literal( $SI->signatureURL ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->locationURI ), + new RDF::Core::Literal( $SI->URL ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( + MOBY::RDF::Predicates::FETA->hasServiceDescriptionText + ), + new RDF::Core::Literal( $SI->description ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( + MOBY::RDF::Predicates::FETA->hasServiceDescriptionLocation + ), + new RDF::Core::Literal( $SI->signatureURL ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::FETA->hasServiceNameText - ), - new RDF::Core::Literal( $SI->name ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( + MOBY::RDF::Predicates::FETA->hasServiceNameText + ), + new RDF::Core::Literal( $SI->name ) + ) ); # TODO get this value! - if ($self->{is_alive_path}) { + if ( -e $self->{is_alive_path} ) { my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($self->{is_alive_path} . '/isAliveStats.xml'); - my $value = "true"; - my $id = $SI->authority . "," . $SI->name; + my $doc = + $parser->parse_file( + $self->{is_alive_path} . '/isAliveStats.xml' ); + my $value = "true"; + my $id = $SI->authority . "," . $SI->name; my @nodelist = $doc->getElementsByTagName("service"); for my $node (@nodelist) { - next unless ($node->getAttribute( 'id' ) eq $id ); + next unless ( $node->getAttribute('id') eq $id ); $value = $node->textContent; last; } $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), - new RDF::Core::Literal($value) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), + new RDF::Core::Literal($value) + ) ); } else { + # by default, state the service is alive ... $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), - new RDF::Core::Literal('true') - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), + new RDF::Core::Literal('true') + ) ); } # add the authoring statements my $bnode = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->providedBy ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::FETA->authoritative ), - new RDF::Core::Literal( - $SI->authoritative == 0 ? "false" : "true" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal( $SI->contactEmail ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal( $SI->authority ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->organisation - ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->providedBy ), + $bnode + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::FETA->authoritative ), + new RDF::Core::Literal( + $SI->authoritative == 0 ? "false" : "true" + ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), + new RDF::Core::Literal( $SI->contactEmail ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), + new RDF::Core::Literal( $SI->authority ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->organisation + ) + ) ); # add parameter statements my $operation = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->hasOperation ), - $operation - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->hasOperationNameText - ), - new RDF::Core::Literal( $SI->name ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->hasOperation ), + $operation + ) ); $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->operation ) - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->hasOperationNameText + ), + new RDF::Core::Literal( $SI->name ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $operation, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->operation ) + ) ); $bnode = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( MOBY::RDF::Predicates::FETA->performsTask ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->operationTask + new RDF::Core::Statement( + $operation, + $resource->new( MOBY::RDF::Predicates::FETA->performsTask ), + $bnode ) - ) ); $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type - ) - ) + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->operationTask + ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + "http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type + ) + ) ); my $inputs = $SI->input; foreach (@$inputs) { my $inputParameter = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->inputParameter - ), - $inputParameter - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->inputParameter + ), + $inputParameter + ) ); if ( $_->isSimple ) { $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $_->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $_->objectType ) #TODO check for lsid ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->simpleParameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->simpleParameter + ) + ) ); my $namespaces = $_->namespaces; foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( @@ -452,67 +476,66 @@ ) ); } - } - elsif ( $_->isCollection ) { + } elsif ( $_->isCollection ) { $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) ); $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->collectionParameter + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->collectionParameter + ) ) - ) ); my $simples = $_->Simples; foreach my $simp (@$simples) { my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $simp->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $simp->objectType ) #TODO check for lsid ) ); @@ -520,31 +543,31 @@ foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( - MOBY::RDF::Predicates::RDF->type - ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA - ->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( + MOBY::RDF::Predicates::RDF->type + ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA + ->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( $inNamespaces, $resource->new( - MOBY::RDF::Predicates::RDF->type + MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" @@ -563,69 +586,69 @@ next unless $_->isSecondary; my $inputParameter = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->inputParameter - ), - $inputParameter - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->inputParameter + ), + $inputParameter + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->secondaryParameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->secondaryParameter + ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->min ), - new RDF::Core::Literal( $_->min ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::FETA->min ), + new RDF::Core::Literal( $_->min ) + ) ) if defined( $_->min ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->max ), - new RDF::Core::Literal( $_->max ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::FETA->max ), + new RDF::Core::Literal( $_->max ) + ) ) if defined( $_->max ); @@ -640,30 +663,30 @@ ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasDefaultValue - ), - new RDF::Core::Literal( $_->default ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasDefaultValue + ), + new RDF::Core::Literal( $_->default ) + ) ) if defined( $_->default ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->datatype ), - new RDF::Core::Literal( $_->datatype ) - ) - ); - foreach my $e ( @{ $_->enum } ) { - $model->addStmt( new RDF::Core::Statement( $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->enum ), - new RDF::Core::Literal($e) + $resource->new( MOBY::RDF::Predicates::FETA->datatype ), + new RDF::Core::Literal( $_->datatype ) ) + ); + foreach my $e ( @{ $_->enum } ) { + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::FETA->enum ), + new RDF::Core::Literal($e) + ) ); } } @@ -672,94 +695,94 @@ foreach (@$outputs) { my $outputParameter = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->outputParameter - ), - $outputParameter - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->outputParameter + ), + $outputParameter + ) ); if ( $_->isSimple ) { $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $outputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $_->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $_->objectType ) #TODO check for lsid ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->simpleParameter - ) - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->simpleParameter + ) + ) ); my $namespaces = $_->namespaces; foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( @@ -772,67 +795,66 @@ ) ); } - } - elsif ( $_->isCollection ) { + } elsif ( $_->isCollection ) { $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $outputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) ); $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->collectionParameter + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->collectionParameter + ) ) - ) ); my $simples = $_->Simples; foreach my $simp (@$simples) { my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $simp->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $simp->objectType ) #TODO check for lsid ) ); @@ -840,31 +862,31 @@ foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( - MOBY::RDF::Predicates::RDF->type - ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA - ->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( + MOBY::RDF::Predicates::RDF->type + ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA + ->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( $inNamespaces, $resource->new( - MOBY::RDF::Predicates::RDF->type + MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" @@ -877,11 +899,11 @@ } } } - my $xml = ''; + my $xml = ''; my $serializer = new RDF::Core::Model::Serializer( - Model => $model, - Output => \$xml, - BaseURI => 'URI://BASE/', + Model => $model, + Output => \$xml, + BaseURI => 'URI://BASE/', ); $serializer->serialize; return $xml; From mwilkinson at dev.open-bio.org Wed Nov 28 16:42:05 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 28 Nov 2007 16:42:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711282142.lASLg5O8028702@dev.open-bio.org> mwilkinson Wed Nov 28 16:42:05 EST 2007 Update of /home/repository/moby/moby-live/Perl In directory dev.open-bio.org:/tmp/cvs-serv28683 Modified Files: MANIFEST Log Message: updated Manifest moby-live/Perl MANIFEST,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MANIFEST,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Perl/MANIFEST 2007/02/06 19:24:03 1.19 +++ /home/repository/moby/moby-live/Perl/MANIFEST 2007/11/28 21:42:05 1.20 @@ -1,34 +1,79 @@ -MANIFEST -README Changes +INSTALL +License Makefile.PL +MANIFEST This list of files +MOBY/Adaptor/moby/DataAccessI.pm +MOBY/Adaptor/moby/DataAdapterI.pm +MOBY/Adaptor/moby/Impl/FetaQueryAdaptor.pm +MOBY/Adaptor/moby/Impl/NamespaceDataAdapter.pm +MOBY/Adaptor/moby/Impl/ObjectDataAdapter.pm +MOBY/Adaptor/moby/Impl/ServiceInstanceDataAdapter.pm +MOBY/Adaptor/moby/Impl/ServiceTypeDataAdapter.pm +MOBY/Adaptor/moby/queryapi.pm +MOBY/Adaptor/moby/queryapi/mysql.pm +MOBY/Admin.pm +MOBY/Async.pm +MOBY/Async/LSAE.pm +MOBY/Async/Service.pm +MOBY/Async/SimpleServer.pm +MOBY/Async/WSRF.pm MOBY/authority.pm +MOBY/Central.pm MOBY/central_db_connection.pm -MOBY/OntologyServer.pm -MOBY/Config.pm -MOBY/dbConfig.pm +MOBY/Client/Central.pm +MOBY/Client/CollectionArticle.pm +MOBY/Client/Exception/MobyException.html +MOBY/Client/Exception/MobyException.pm +MOBY/Client/Exception/MobyExceptionCodes.html +MOBY/Client/Exception/MobyExceptionCodes.pm +MOBY/Client/OntologyServer.pm +MOBY/Client/Registration.pm +MOBY/Client/SecondaryArticle.pm +MOBY/Client/Service.pm +MOBY/Client/ServiceInstance.pm +MOBY/Client/SimpleArticle.pm +MOBY/Client/SimpleInput.pm +MOBY/collection_input.pm +MOBY/collection_output.pm MOBY/CommonSubs.pm +MOBY/Config.pm MOBY/CrossReference.pm +MOBY/dbConfig.pm +MOBY/lsid/authority/lsid_resolver.kpf +MOBY/lsid/authority/MobyMetadataResolver.pm +MOBY/MobyXMLConstants.pm +MOBY/MobyXMLRetriever.pl +MOBY/MOBYXSLT.pm +MOBY/myScript.pl +MOBY/mysql.pm +MOBY/OntologyServer.pm +MOBY/RDF/Ontologies/Cache/CacheUtils.pm +MOBY/RDF/Ontologies/Cache/ServiceCache.pm +MOBY/RDF/Ontologies/Namespaces.pm +MOBY/RDF/Ontologies/Objects.pm +MOBY/RDF/Ontologies/Services.pm +MOBY/RDF/Ontologies/ServiceTypes.pm +MOBY/RDF/Predicates/DC_PROTEGE.pm +MOBY/RDF/Predicates/FETA.pm +MOBY/RDF/Predicates/MOBY_PREDICATES.pm +MOBY/RDF/Predicates/OMG_LSID.pm +MOBY/RDF/Predicates/OWL.pm +MOBY/RDF/Predicates/RDF.pm +MOBY/RDF/Predicates/RDFS.pm +MOBY/RDF/Utils.pm +MOBY/secondary_input.pm MOBY/service_instance.pm MOBY/service_type.pm MOBY/simple_input.pm MOBY/simple_output.pm -MOBY/Central.pm -MOBY/Client/Central.pm -MOBY/Client/Registration.pm -MOBY/Client/ServiceInstance.pm -MOBY/Client/CollectionArticle.pm -MOBY/Client/OntologyServer.pm -MOBY/Client/SimpleArticle.pm -MOBY/Client/Service.pm -MOBY/Adaptor/moby/queryapi.pm -MOBY/Adaptor/moby/queryapi/mysql.pm MOBY/SOAP/Serializer.pm -MOBY/Async/LSAE.pm -MOBY/Async/Service.pm -MOBY/Async/SimpleServer.pm -MOBY/Async/WSRF.pm +MOBY/xsl/parseMobyMessage.xsl +README +scripts/AgentRDFValidator +scripts/authority.pl scripts/CloneCentralDatabases.pl +scripts/data.txt scripts/DebugYourService.pl scripts/FindServices.pl scripts/GetDump.pl @@ -36,8 +81,26 @@ scripts/GetResourceURLs.pl scripts/GetServicesProviders.pl scripts/GetServicesTypes.pl +scripts/MOBY-Admin.pl scripts/MOBY-Central.pl -scripts/Services.cgi +scripts/MOBY-Client05.cgi scripts/OntologyServer.cgi +scripts/RESOURCES +scripts/service_tester.pl +scripts/Services.cgi scripts/Services/HelloWorldService.pm scripts/Services/LocalServices.pm +scripts/ValidateService +t/Central.t +t/Client-Central.t +t/Client-CollectionArticle.t +t/Client-OntologyServer.t +t/Client-Registration.t +t/Client-SecondaryArticle.t +t/Client-Service.t +t/Client-ServiceInstance.t +t/Client-SimpleArticle.t +t/CommonSubs.t +t/Config.t +t/CrossReference.t +t/Template.t From kawas at dev.open-bio.org Wed Nov 28 18:33:22 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 18:33:22 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711282333.lASNXMwV028839@dev.open-bio.org> kawas Wed Nov 28 18:33:22 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv28803/RDF Modified Files: Utils.pm Log Message: If libXSLT isnt installed, then the style sheet wont be apply, otherwise it is. moby-live/Perl/MOBY/RDF Utils.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/07/06 15:02:18 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/11/28 23:33:22 1.3 @@ -9,7 +9,6 @@ package MOBY::RDF::Utils; use XML::LibXML; -#use XML::LibXSLT; use strict; @@ -96,15 +95,24 @@ END } - my $parser = XML::LibXML->new(); -# my $xslt = XML::LibXSLT->new(); - my $source = $parser->parse_string($xml); -# my $style_doc = $parser->parse_string( $self->{xslt} ); -# my $stylesheet = $xslt->parse_stylesheet($style_doc); -# my $results = $stylesheet->transform($source); -# $xml = $stylesheet->output_string($results); - $xml = $source->toString(0); - return $xml; + + eval "require XML::LibXSLT"; + if ($@) { + my $parser = XML::LibXML->new(); + my $source = $parser->parse_string($xml); + $xml = $source->toString(0); + return $xml; + } else { + use XML::LibXSLT; + my $parser = XML::LibXML->new(); + my $xslt = XML::LibXSLT->new(); + my $source = $parser->parse_string($xml); + my $style_doc = $parser->parse_string( $self->{xslt} ); + my $stylesheet = $xslt->parse_stylesheet($style_doc); + my $results = $stylesheet->transform($source); + $xml = $stylesheet->output_string($results); + return "". $xml; + } } 1; From kawas at dev.open-bio.org Thu Nov 29 11:59:04 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 11:59:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291659.lATGx4xG030795@dev.open-bio.org> kawas Thu Nov 29 11:59:04 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv30748/Java/src/main/org/biomoby/shared/extended Modified Files: NamespaceParser.java ServiceInstanceParser.java DataTypeParser.java ServiceTypeParser.java Log Message: Changes include *takes into account URIs that don't have '#' in them, but have '/' *made code compliant with java1.5 so that warnings disappear moby-live/Java/src/main/org/biomoby/shared/extended NamespaceParser.java,1.7,1.8 ServiceInstanceParser.java,1.20,1.21 DataTypeParser.java,1.7,1.8 ServiceTypeParser.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2006/04/27 14:47:37 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2007/11/29 16:59:04 1.8 @@ -149,7 +149,7 @@ + this.url); // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -166,7 +166,9 @@ String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); - + else if(uri.lastIndexOf("/Namespaces/") > 0) { + name = uri.substring(uri.lastIndexOf("/Namepaces/")+"/Namespaces/".length()); + } MobyNamespace namespace = new MobyNamespace(name); if (resource.hasProperty(DC_PROTEGE.identifier)) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/12/07 16:37:36 1.20 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2007/11/29 16:59:04 1.21 @@ -8,7 +8,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import org.biomoby.client.rdf.vocabulary.DC_PROTEGE; @@ -151,7 +150,7 @@ + this.url); } // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -176,7 +175,7 @@ */ public MobyService[] getMobyServicesFromRDF(Model model) throws MobyException { // clear out any old information - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); if (model != null) { // lets start parsing this.parsedOkay = processModel(list, model); @@ -190,7 +189,7 @@ /** * @param list the list to put the services in @param model the model to use */ - private boolean processModel(ArrayList list, Model model) { + private boolean processModel(ArrayList list, Model model) { // clear out any old information this.parsedOkay = false; this.errors = new StringBuffer(); @@ -240,8 +239,10 @@ String[] parsedServiceType = serviceType.split("#"); if (parsedServiceType.length == 2) service.setType(parsedServiceType[1]); - else - service.setType(parsedServiceType[0]); + else if(serviceType.lastIndexOf("/Services/") > 0) { + service.setType(serviceType.substring(serviceType.lastIndexOf("/Services/")+"/Services/".length())); + } else + service.setType(parsedServiceType[0]); } } } @@ -307,8 +308,8 @@ Resource r = (Resource) s.getObject(); StmtIterator inputs = r.listProperties(FetaVocabulary.inputParameter); // collections to be added at the end the current scope - Map inputCollectionMap = new HashMap(); - Map outputCollectionMap = new HashMap(); + Map inputCollectionMap = new HashMap(); + Map outputCollectionMap = new HashMap(); // is the current service bad? while (inputs.hasNext()) { @@ -367,7 +368,9 @@ if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); - + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( FetaVocabulary.hasParameterNameText).getObject().toString(); @@ -381,7 +384,7 @@ continue; } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -395,6 +398,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns = ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -405,10 +411,8 @@ primaryInput.setDataType(new MobyDataType(datatype)); primaryInput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryInput.addNamespace(new MobyNamespace((String) nsIterator - .next())); + for (String ns : namespaces) { + primaryInput.addNamespace(new MobyNamespace(ns)); } } service.addInput(primaryInput); @@ -458,6 +462,9 @@ } if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( @@ -473,7 +480,7 @@ } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -487,6 +494,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns = ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -503,11 +513,9 @@ MobyPrimaryDataSimple input = new MobyPrimaryDataSimple(""); input.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { + for (String ns : namespaces) { input - .addNamespace(new MobyNamespace((String) nsIterator - .next())); + .addNamespace(new MobyNamespace(ns)); } } collection.addElement(input); @@ -684,7 +692,9 @@ .toString();*/ if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); - + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( FetaVocabulary.hasParameterNameText).getObject().toString(); @@ -695,7 +705,7 @@ // article name"); } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -709,6 +719,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns = ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -719,10 +732,8 @@ primaryOutput.setDataType(new MobyDataType(datatype)); primaryOutput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryOutput.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (String ns : namespaces) { + primaryOutput.addNamespace(new MobyNamespace(ns)); } } service.addOutput(primaryOutput); @@ -773,7 +784,9 @@ if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); - + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( FetaVocabulary.hasParameterNameText).getObject().toString(); @@ -789,7 +802,7 @@ } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -803,6 +816,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns= ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -819,10 +835,8 @@ MobyPrimaryDataSimple output = new MobyPrimaryDataSimple(""); output.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - output.addNamespace(new MobyNamespace((String) nsIterator - .next())); + for (String ns : namespaces) { + output.addNamespace(new MobyNamespace(ns)); } } collection.addElement(output); @@ -832,14 +846,11 @@ } // add the collections to the service - Iterator it = null; - for (it = inputCollectionMap.keySet().iterator(); it.hasNext();) { - service.addInput((MobyPrimaryDataSet) inputCollectionMap - .get((String) it.next())); + for (String key : inputCollectionMap.keySet()) { + service.addInput((MobyPrimaryDataSet) inputCollectionMap.get(key)); } - for (it = outputCollectionMap.keySet().iterator(); it.hasNext();) { - service.addOutput((MobyPrimaryDataSet) outputCollectionMap.get((String) it - .next())); + for (String key : outputCollectionMap.keySet()) { + service.addOutput((MobyPrimaryDataSet) outputCollectionMap.get(key)); } } if (!currentlyBad) @@ -859,7 +870,7 @@ public MobyService[] getMobyServicesFromRDF(String rdf) throws MobyException { // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -960,8 +971,9 @@ public static void main(String[] args) throws MobyException, MalformedURLException, IOException { // show how to use this class - ServiceInstanceParser p = new ServiceInstanceParser("http://localhost/ServiceInstance.rdf"); + ServiceInstanceParser p = new ServiceInstanceParser("http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances"); MobyService[] services = p.getMobyServicesFromRDF(); + System.out.println(services.length); if (!p.isRDFValid()) { System.out.println("One or more services in the RDF were invalid"); System.out.println("The errors are the following:"); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2007/07/17 18:11:42 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2007/11/29 16:59:04 1.8 @@ -154,7 +154,7 @@ + this.url); // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -173,12 +173,17 @@ String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); - + else if(uri.lastIndexOf("/Objects/") > 0) { + name = uri.substring(uri.lastIndexOf("/Objects/")+"/Objects/".length()); + } String parent = null; if (resource.hasProperty(RDFS.subClassOf)) { parent = ((Resource)resource.getProperty(RDFS.subClassOf).getObject()).getURI(); if (parent.indexOf("#") > 0) parent = parent.substring(parent.indexOf("#")+1); + else if(parent.lastIndexOf("/Objects/") > 0) { + parent = parent.substring(parent.lastIndexOf("/Objects/")+"/Objects/".length()); + } } String description = resource.getProperty(RDFS.comment).getLiteral().getString(); // create the base datatype without container relationships =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2006/04/27 14:47:37 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2007/11/29 16:59:04 1.9 @@ -147,7 +147,7 @@ + this.url); // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -163,7 +163,9 @@ String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); - + else if(uri.lastIndexOf("/Services/") > 0) { + name = uri.substring(uri.lastIndexOf("/Services/")+"/Services/".length()); + } MobyServiceType servicetype = new MobyServiceType(name); if (resource.hasProperty(DC_PROTEGE.identifier)) { @@ -177,6 +179,9 @@ String parent = resource.getProperty(RDFS.subClassOf).getObject().toString(); if (parent.indexOf("#") > 0) parent = parent.substring(parent.indexOf("#")+1); + else if(parent.lastIndexOf("/Services/") > 0) { + parent = parent.substring(parent.lastIndexOf("/Services/")+"/Services/".length()); + } servicetype.setParentNames(new String[] {parent}); String description = resource.getProperty(RDFS.comment).getLiteral().getString(); servicetype.setDescription(description); From kawas at dev.open-bio.org Thu Nov 29 12:52:40 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 12:52:40 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291752.lATHqe7h031426@dev.open-bio.org> kawas Thu Nov 29 12:52:40 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31379/RDF/Ontologies Modified Files: Objects.pm Namespaces.pm Services.pm ServiceTypes.pm Log Message: *modified the db access code (connections are now created and destroyed as needed, rather than trying to maintain a single connection) *modified how URIs are obtained and used when creating RDF moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.4,1.5 Namespaces.pm,1.3,1.4 Services.pm,1.6,1.7 ServiceTypes.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/19 18:26:59 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/11/29 17:52:40 1.5 @@ -78,7 +78,6 @@ my $CONF = MOBY::Config->new; $self->{uri} = $CONF->{mobyobject}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; - $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyobject" )->dbh; $self->{uri_comp} = $self->{uri}; $self->{uri_comp} =~ s/\/MOBY\-S\//\/MOBY_SUB_COMPONENT\//; @@ -127,7 +126,7 @@ # add root of ontology $self->_addOntologyRoot($model); - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyobject" )->dbh; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -152,7 +151,6 @@ } $sth->finish(); $db->disconnect(); - my $xml = ''; my $serializer = new RDF::Core::Model::Serializer( Model => $model, @@ -198,7 +196,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyobject" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -443,9 +441,10 @@ my ( $self, $model, $term ) = @_; my $termExists = 0; - + + do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyobject" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/19 18:26:59 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/11/29 17:52:40 1.4 @@ -76,7 +76,6 @@ my $CONF = MOBY::Config->new; $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; - $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobynamespace" )->dbh; $self->{query_all} = <{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobynamespace" )->dbh; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -306,7 +305,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobynamespace" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/28 20:01:23 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/29 17:52:40 1.7 @@ -81,6 +81,18 @@ #----------------------------------------------------------------- # new #----------------------------------------------------------------- + +=head2 new + +Instantiate a Services object. + +Parameters: + * A Hash with keys: + -> endpoint => the BioMOBY registry endpoint to use + -> namespace => the BioMOBY registry namespace to use + +=cut + sub new { my ( $class, %args ) = @_; @@ -89,16 +101,64 @@ # save some information retrieved from mobycentral.config my $CONF = MOBY::Config->new; - $self->{uri} = $CONF->{mobycentral}->{resourceURL} - || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#' unless (defined $args{uri} and $args{uri}); + + # FIXME get me from api call + $self->{instance_uri} = $CONF->{mobycentral}->{resourceURL} || ''; + $self->{service_uri} = $CONF->{mobyservice}->{resourceURL} || ''; + $self->{datatype_uri} = $CONF->{mobyobject}->{resourceURL} || ''; + $self->{namespace_uri} = $CONF->{mobynamespace}->{resourceURL} || ''; # save the endpoint/namespace/uri if passed in $self->{endpoint} = $args{endpoint} if $args{endpoint}; $self->{namespace} = $args{endpoint} if $args{namespace}; - $self->{uri} = $args{uri} if $args{uri} and defined $args{uri}; - # add a # at the end of the uri if it isnt there already - $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + unless ( $self->{instance_uri} ) { + my $moby = MOBY::Client::Central->new( + Registries => { + mobycentral => { + URL => $self->{endpoint}, + URI => 'http://mobycentral.cbr.nrc.ca/MOBY/Central' + } + } + ) + if $self->{endpoint}; + + # otherwise use default one + $moby = MOBY::Client::Central->new() unless $self->{endpoint}; + + # moby is a hash ref now + $moby = $moby->retrieveResourceURLs(); + + # add all uris + $self->{instance_uri} = $moby->{ServiceInstance}->[0] + if $moby->{ServiceInstance}->[0]; + $self->{service_uri} = $moby->{Services}->[0] if $moby->{Services}->[0]; + $self->{namespace_uri} = $moby->{Namespaces}->[0] + if $moby->{Namespaces}->[0]; + $self->{datatype_uri} = $moby->{Objects}->[0] if $moby->{Objects}->[0]; + + #revert to a default value if nothing is retrieved + $self->{instance_uri} = + 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#' + unless $moby->{ServiceInstance}->[0]; + $self->{service_uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Services#' + unless $moby->{Services}->[0]; + $self->{namespace_uri} = + 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#' + unless $moby->{Namespaces}->[0]; + $self->{datatype_uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#' + unless $moby->{Objects}->[0]; + } + + # add a / at the end of the uri if it isnt there already + $self->{instance_uri} = $self->{instance_uri} . "#" + unless $self->{instance_uri} =~ m/^.*(\#{1})$/; + $self->{service_uri} = $self->{service_uri} . "#" + unless $self->{service_uri} =~ m/^.*(\#{1})$/; + $self->{namespace_uri} = $self->{namespace_uri} . "#" + unless $self->{namespace_uri} =~ m/^.*(\#{1})$/; + $self->{datatype_uri} = $self->{datatype_uri} . "#" + unless $self->{datatype_uri} =~ m/^.*(\#{1})$/; $self->{is_alive_path} = $CONF->{mobycentral}->{service_tester_path}; @@ -184,7 +244,7 @@ foreach my $SI (@$services) { my $resource = - new RDF::Core::Resource( $self->{uri}, + new RDF::Core::Resource( $self->{instance_uri}, $SI->authority . "," . $SI->name ); $model->addStmt( new RDF::Core::Statement( @@ -367,7 +427,7 @@ $bnode, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type + $self->{service_uri} . $SI->type ) ) ); @@ -419,7 +479,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $_->objectType ) #TODO check for lsid ) @@ -470,7 +530,7 @@ $inNamespaces, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) @@ -534,7 +594,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $simp->objectType ) #TODO check for lsid ) @@ -570,7 +630,7 @@ MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) @@ -738,7 +798,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $_->objectType ) #TODO check for lsid ) @@ -789,7 +849,7 @@ $inNamespaces, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) @@ -853,7 +913,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $simp->objectType ) #TODO check for lsid ) @@ -889,7 +949,7 @@ MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/07/19 18:26:59 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/11/29 17:52:40 1.3 @@ -77,7 +77,6 @@ my $CONF = MOBY::Config->new; $self->{uri} = $CONF->{mobyservice}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Services#'; $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; - $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyservice" )->dbh; $self->{query_all} = <{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyservice" )->dbh; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -313,7 +312,7 @@ # add the datatype Object to the model do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyservice" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); From kawas at dev.open-bio.org Thu Nov 29 12:53:34 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 12:53:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291753.lATHrYMR031520@dev.open-bio.org> kawas Thu Nov 29 12:53:34 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv31485/RDF/Ontologies/Cache Modified Files: CacheUtils.pm Log Message: slightly updated the doc for 'new' moby-live/Perl/MOBY/RDF/Ontologies/Cache CacheUtils.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/CacheUtils.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/CacheUtils.pm 2007/11/28 19:58:46 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/CacheUtils.pm 2007/11/29 17:53:34 1.2 @@ -80,9 +80,9 @@ Parameters: * A Hash with keys: - -> endpoint => the BioMOBY registry endpoint to use - -> namespace => the BioMOBY registry namespace to use - -> cache => the directory to store the cache + -> endpoint => the BioMOBY registry endpoint to use + -> namespace => the BioMOBY registry namespace to use + -> cache => the directory to store the cache If endpoint or cache are not specified, then new fails (dies). From kawas at dev.open-bio.org Thu Nov 29 12:54:58 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 12:54:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291754.lATHswOg031578@dev.open-bio.org> kawas Thu Nov 29 12:54:58 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv31543/RDF/Ontologies/Cache Modified Files: ServiceCache.pm Log Message: removed all instances where uri was passed in to the RDF generators moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/28 19:58:46 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 17:54:58 1.2 @@ -35,16 +35,17 @@ =head1 SYNOPSIS + # required my $cachedir = "/tmp/"; + + # optional - gets default values from MOBY::Client::Central my $url = "http://moby.ucalgary.ca/moby/MOBY-Central.pl"; my $uri = "http://moby.ucalgary.ca/MOBY/Central"; - my $service_uri = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; my $x = MOBY::RDF::Ontologies::Cache::ServiceCache->new( endpoint => $url, namespace => $uri, cache => $cachedir, - uri => $service_uri ); # create the service cache @@ -82,14 +83,9 @@ Parameters: * A Hash with keys: - -> endpoint => the BioMOBY registry endpoint to use - -> namespace => the BioMOBY registry namespace to use - -> cache => the directory to store the cache - -> uri => the service instance uri, - i.e. http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances# - This parameter is necessary if you are trying to generate - RDF for a non-default (neither your own local one or - the default mobycentral) registry! + -> endpoint => the BioMOBY registry endpoint to use + -> namespace => the BioMOBY registry namespace to use + -> cache => the directory to store the cache This subroutine attempts to create the cache directories right away and if any problems occur then an Exception is thrown. @@ -106,7 +102,7 @@ $self->{endpoint} = $args{endpoint} if $args{endpoint}; $self->{namespace} = $args{namespace} if $args{namespace}; $self->{cachedir} = $args{cache} if $args{cache}; - $self->{uri} = $args{uri} if $args{uri}; + eval { $self->{endpoint} = MOBY::Client::Central->new()->{default_MOBY_server}; @@ -167,7 +163,6 @@ $authorities_completed{$name} = 1; $xml = MOBY::RDF::Ontologies::Services->new( - uri => $self->{uri}, endpoint => $self->{utils}->_endpoint ); $xml = $xml->findService( { authURI => $name } ); my $file = File::Spec->catfile( @@ -315,8 +310,7 @@ foreach my $authURI ( keys %changed_services ) { $wasOld++; $xml = MOBY::RDF::Ontologies::Services->new( - endpoint => $self->{utils}->_endpoint, - uri => $self->{uri} ); + endpoint => $self->{utils}->_endpoint, ); $xml = $xml->findService( { authURI => $authURI } ); $file = File::Spec->catfile( From kawas at dev.open-bio.org Thu Nov 29 13:03:05 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 13:03:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291803.lATI354Z031661@dev.open-bio.org> kawas Thu Nov 29 13:03:05 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv31626/RDF/Ontologies/Cache Modified Files: ServiceCache.pm Log Message: removed a DEBUG print statement moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 17:54:58 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 18:03:05 1.3 @@ -351,7 +351,6 @@ sub get_rdf { my ($self) = @_; my $xml = ""; -print STDERR Dumper(\$self); my $lock = File::Spec->catfile( $self->{utils}->cachedir, $self->{utils}->_clean( $self->{utils}->_endpoint ), From kawas at dev.open-bio.org Thu Nov 29 13:09:31 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 13:09:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291809.lATI9Vdd031722@dev.open-bio.org> kawas Thu Nov 29 13:09:31 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv31687/RDF Modified Files: Utils.pm Log Message: removed the use LibXSLT because it wasnt needed moby-live/Perl/MOBY/RDF Utils.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/11/28 23:33:22 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/11/29 18:09:31 1.4 @@ -103,7 +103,6 @@ $xml = $source->toString(0); return $xml; } else { - use XML::LibXSLT; my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); my $source = $parser->parse_string($xml); From kawas at dev.open-bio.org Thu Nov 29 14:45:55 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 14:45:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291945.lATJjtDf031922@dev.open-bio.org> kawas Thu Nov 29 14:45:54 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31887/RDF/Ontologies Modified Files: Services.pm Log Message: added statement to ensure that is_alive_path is defined before using moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/29 17:52:40 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/29 19:45:54 1.8 @@ -305,7 +305,7 @@ ); # TODO get this value! - if ( -e $self->{is_alive_path} ) { + if ( $self->{is_alive_path} and -e $self->{is_alive_path} ) { my $parser = XML::LibXML->new(); my $doc = $parser->parse_file( From kawas at dev.open-bio.org Thu Nov 29 14:59:51 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 14:59:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291959.lATJxpLS032040@dev.open-bio.org> kawas Thu Nov 29 14:59:51 EST 2007 Update of /home/repository/moby/moby-live/Perl/scripts In directory dev.open-bio.org:/tmp/cvs-serv32005/Perl/scripts Modified Files: RESOURCES Log Message: added service instance caching to the script moby-live/Perl/scripts RESOURCES,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/RESOURCES,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/scripts/RESOURCES 2007/08/14 23:28:36 1.1 +++ /home/repository/moby/moby-live/Perl/scripts/RESOURCES 2007/11/29 19:59:51 1.2 @@ -1,61 +1,105 @@ -#!/usr/bin/perl -w -#----------------------------------------------------------------- -# RESOURCES -# Author: Edward Kawas , -# For copyright and disclaimer see below. -# -# $Id$ -#----------------------------------------------------------------- - -# this is a 're-port' of the RESOURCES script from java back to perl - -use strict; -use CGI qw/:standard/; -use MOBY::RDF::Ontologies::Objects; -use MOBY::RDF::Ontologies::ServiceTypes; -use MOBY::RDF::Ontologies::Namespaces; -use MOBY::RDF::Ontologies::Services; - - -my $url = url(-relative=>1, -path_info=>1); - -my $form = new CGI; - -if ($url =~ m/^RESOURCES\/MOBY\-S\/Objects$/) { - - my $x = MOBY::RDF::Ontologies::Objects->new; - $x = $x->createAll(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/Services$/) { - my $x = MOBY::RDF::Ontologies::ServiceTypes->new; - $x = $x->createAll(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/ServiceInstances$/) { - my $x = MOBY::RDF::Ontologies::Services->new; - $x = $x->findService(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/Namespaces$/) { - my $x = MOBY::RDF::Ontologies::Namespaces->new; - $x = $x->createAll(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/FULL$/) { - print $form->header('text/html'); - $form->start_html(-title=>'unavailable',); - print h2("not","implemented"); - print end_html; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/ServiceDescription$/) { - print $form->header('text/html'); - $form->start_html(-title=>'unavailable',); - print h2("not","implemented"); - print end_html; -} else { - print $form->header('text/html'); - $form->start_html(-title=>'not MOBY-S',); - print h2("not","MOBY-S"); - print end_html; -} - +#!/usr/bin/perl -w +#----------------------------------------------------------------- +# RESOURCES +# Author: Edward Kawas , +# For copyright and disclaimer see below. +# +# $Id$ +# +# NOTES: +# 1. This script assumes that a BioMOBY registry is properly +# installed and that SetEnv commands have been added to +# the servers environment (e.g. httpd.conf) +# +# 2. Caching is enabled by default and can be toggled by +# modifying $useCache [0=> disbled, 1=> enabled] +# Caching really speeds up RDF generation and is highly +# recomended +# +# 3. Caching requires that a cache dir be specified and +# that the directory is readable by the web server +# process. By default, the cache dir is set to '/tmp/' +#----------------------------------------------------------------- + +# this is a 're-port' of the RESOURCES script from java back to perl + +use strict; +use CGI qw/:standard/; +use MOBY::RDF::Ontologies::Objects; +use MOBY::RDF::Ontologies::ServiceTypes; +use MOBY::RDF::Ontologies::Namespaces; +use MOBY::RDF::Ontologies::Services; +use MOBY::RDF::Ontologies::Cache::ServiceCache; + +# your cache dir +my $dir = "/tmp/"; + +# should we use caching? +my $useCache = 1; + +my $url = url( -relative => 1, -path_info => 1 ); + +my $form = new CGI; + +if ( $url =~ m/^RESOURCES\/MOBY\-S\/Objects$/ ) { + + my $x = MOBY::RDF::Ontologies::Objects->new; + $x = $x->createAll(); + print $form->header('text/xml'), $x if $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Services$/ ) { + my $x = MOBY::RDF::Ontologies::ServiceTypes->new; + $x = $x->createAll(); + print $form->header('text/xml'), $x if $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/ServiceInstances$/ ) { + my $x; + # shall we use the cache? + if ($useCache) { + $x = + MOBY::RDF::Ontologies::Cache::ServiceCache->new( cache => "$dir", ); + $x = $x->get_rdf(); + + } else { + # no cache + $x = MOBY::RDF::Ontologies::Services->new; + $x = $x->findService(); + + } + # output the RDF generated + print $form->header('text/xml'), $x if $x; + # say not implemented if an error occurs + do { + print $form->header('text/html'); + $form->start_html( -title => 'unavailable', ); + print h2( "not", "implemented" ); + print end_html; + } unless $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Namespaces$/ ) { + + my $x = MOBY::RDF::Ontologies::Namespaces->new; + $x = $x->createAll(); + print $form->header('text/xml'), $x if $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/FULL$/ ) { + + print $form->header('text/html'); + $form->start_html( -title => 'unavailable', ); + print h2( "not", "implemented" ); + print end_html; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/ServiceDescription$/ ) { + print $form->header('text/html'); + $form->start_html( -title => 'unavailable', ); + print h2( "not", "implemented" ); + print end_html; + +} else { + + print $form->header('text/html'); + $form->start_html( -title => 'not MOBY-S', ); + print h2( "not", "MOBY-S" ); + print end_html; +} + From kawas at dev.open-bio.org Thu Nov 29 16:47:00 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 16:47:00 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711292147.lATLl0So032183@dev.open-bio.org> kawas Thu Nov 29 16:47:00 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv32147/RDF/Ontologies/Cache Modified Files: ServiceCache.pm Log Message: added code that removes cached file segments when they no longer are deemed necessary moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 18:03:05 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 21:47:00 1.4 @@ -377,7 +377,9 @@ # check if we need to re-merge the RDF my $isStale = $self->update_service_cache; if ( $isStale or !( -e $file ) ) { - + + my $providers = $self->_get_service_providers; + # re-merge rdf my $parser = XML::LibXML->new(); my $doc = undef; @@ -391,6 +393,8 @@ if $RDF eq $self->{utils}->RDF_FILE or $RDF eq $self->{utils}->LIST_FILE or $RDF eq $self->{utils}->UPDATE_FILE; + #remove those authorities that dont have any services + unlink(File::Spec->catfile( $dir, $RDF )) unless $providers->{$RDF}; do { eval { $doc = @@ -435,6 +439,37 @@ return $xml; } +sub _get_service_providers { + my ($self) = @_; + my $soap = + SOAP::Lite->uri( $self->{utils}->_namespace ) + ->proxy( $self->{utils}->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + die( "There was a problem calling the registry: " + . $self->{utils}->_endpoint . "\@ " + #. $self->{utils}->_namespace . ".\n" + . $res ); + } + ); + + my $xml = $soap->retrieveServiceNames()->result; + my %providers = (); + + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_string($xml); + my $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for ( 1 .. $nodes->size() ) { + my $name = $nodes->get_node($_)->getAttribute('authURI'); + next if $providers{$name}; + $providers{$name} = 1; + } + + return \%providers; + +} + # creates the list file and returns it as a string sub _create_list_file { my ($self) = @_; From groscurt at dev.open-bio.org Fri Nov 30 03:49:10 2007 From: groscurt at dev.open-bio.org (Andreas Groscurth) Date: Fri, 30 Nov 2007 03:49:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711300849.lAU8nAY8000943@dev.open-bio.org> groscurt Fri Nov 30 03:49:09 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync In directory dev.open-bio.org:/tmp/cvs-serv907/src/main/org/biomoby/registry/sync Modified Files: CentralFactory.java Log Message: javadoc fix moby-live/Java/src/main/org/biomoby/registry/sync CentralFactory.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/CentralFactory.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/registry/sync/CentralFactory.java 2007/08/24 09:38:57 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/CentralFactory.java 2007/11/30 08:49:09 1.2 @@ -46,7 +46,6 @@ * @return the local central * @throws MobyException * whether the local central is not initialised - * @uml.property name="localCentral" */ public static CentralDigestImpl getLocalCentral() throws MobyException { if ( localCentral == null ) { @@ -61,7 +60,6 @@ * @return the master central * @throws MobyException * whether the master central is not initialised - * @uml.property name="masterCentral" */ public static CentralDigestImpl getMasterCentral() throws MobyException { if ( masterCentral == null ) { From groscurt at dev.open-bio.org Fri Nov 30 03:49:33 2007 From: groscurt at dev.open-bio.org (Andreas Groscurth) Date: Fri, 30 Nov 2007 03:49:33 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711300849.lAU8nX5d001002@dev.open-bio.org> groscurt Fri Nov 30 03:49:32 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler In directory dev.open-bio.org:/tmp/cvs-serv951/src/main/org/biomoby/registry/sync/handler Modified Files: ServiceTypeHandler.java DataTypeHandler.java AbstractMobyHandler.java ServiceHandler.java NamespaceHandler.java Log Message: javadoc fix moby-live/Java/src/main/org/biomoby/registry/sync/handler ServiceTypeHandler.java,1.1,1.2 DataTypeHandler.java,1.1,1.2 AbstractMobyHandler.java,1.1,1.2 ServiceHandler.java,1.1,1.2 NamespaceHandler.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceTypeHandler.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/registry/sync/handler/ServiceTypeHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceTypeHandler.java 2007/11/30 08:49:32 1.2 @@ -14,9 +14,6 @@ super(authority); } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyServiceType object ) { try { localCentral.registerServiceType( object ); @@ -29,9 +26,6 @@ return true; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyServiceType object ) { try { localCentral.unregisterServiceType( object ); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/DataTypeHandler.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/registry/sync/handler/DataTypeHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/DataTypeHandler.java 2007/11/30 08:49:32 1.2 @@ -13,9 +13,6 @@ super(authority); } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyDataType dataType ) { try { // try to register the full datatype @@ -29,9 +26,6 @@ return true; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyDataType dataType ) { try { // try to unregister the datatype =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/AbstractMobyHandler.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/registry/sync/handler/AbstractMobyHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/AbstractMobyHandler.java 2007/11/30 08:49:32 1.2 @@ -54,9 +54,6 @@ return centralLSID.compareToIgnoreCase( localLSID ) > 0; } - /** - * @see MobyHandler#change(T) - */ public boolean change( T object ) { if ( unregister( object ) ) { logger.fine( object.getLSID() + " was unregistered and will now be added to the local repository !" ); @@ -81,7 +78,7 @@ * * @param centralList * the entries of the master central - * @param localList + * @param local * the entries of the local central */ @SuppressWarnings( "unchecked" ) =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceHandler.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/registry/sync/handler/ServiceHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceHandler.java 2007/11/30 08:49:32 1.2 @@ -76,9 +76,6 @@ return false; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyService service ) { // the central admin class enables to delete a service @@ -100,9 +97,6 @@ return code == 200; } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyService service ) { // check whether the service shall be ignored due to the defined filter rules if ( ServiceFilter.getServiceFilter().isServiceFiltered( service ) ) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/NamespaceHandler.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/registry/sync/handler/NamespaceHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/NamespaceHandler.java 2007/11/30 08:49:32 1.2 @@ -13,9 +13,6 @@ super(authority); } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyNamespace namespace ) { try { // try to register the namespace at the local central @@ -28,9 +25,6 @@ return true; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyNamespace namespace ) { try { // try to unregister the namespace From gordonp at dev.open-bio.org Fri Nov 30 12:23:17 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:23:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301723.lAUHNGwI002897@dev.open-bio.org> gordonp Fri Nov 30 12:23:16 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv2857/src/main/org/biomoby/client Modified Files: CentralCachedCallsImpl.java MobyRequest.java Log Message: Fixed missing passing of the registry to c-tors, which caused incorrect use of default registry for DOM-based object building moby-live/Java/src/main/org/biomoby/client CentralCachedCallsImpl.java,1.3,1.4 MobyRequest.java,1.27,1.28 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralCachedCallsImpl.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/client/CentralCachedCallsImpl.java 2007/06/08 20:30:22 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralCachedCallsImpl.java 2007/11/30 17:23:16 1.4 @@ -1,11 +1,3 @@ -/** - * Implements the functionality of caching by reusing identical calls to - * MOBY central (e.g. asking multiple times what services take a DNA - * sequence in the gi namespace). This is an in-memory cache in CentralImpl, - * but a filesystem cache backs it up here, so calls can be cached between - * JVM instances. - */ - package org.biomoby.client; import org.biomoby.registry.meta.RegistryCache; @@ -15,6 +7,15 @@ import java.io.*; import java.util.*; +/** + * Implements the functionality of caching by reusing identical calls to + * MOBY central (e.g. asking multiple times what services take a DNA + * sequence in the gi namespace). This is an in-memory cache in CentralImpl, + * but a filesystem cache backs it up here, so calls can be cached between + * JVM instances. This class is also thread-safe, and avoids redundant + * concurrent calls to the central registry. + */ + public class CentralCachedCallsImpl extends CentralImpl{ protected static String CHAR_ENCODING = "UTF-8"; protected static final String SYNTAX_TYPE = "xml"; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2007/06/16 00:26:01 1.27 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2007/11/30 17:23:16 1.28 @@ -529,6 +529,8 @@ mobyService.getName()), mobyXMLInputData); } catch(Exception e){ + e.printStackTrace(); + //System.err.println("Input: "+mobyInputXML); throw new SOAPException("While invoking SOAP Call: " + e); } From gordonp at dev.open-bio.org Fri Nov 30 12:23:17 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:23:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301723.lAUHNHWP002915@dev.open-bio.org> gordonp Fri Nov 30 12:23:16 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv2857/src/main/org/biomoby/shared Modified Files: MobyDataType.java Log Message: Fixed missing passing of the registry to c-tors, which caused incorrect use of default registry for DOM-based object building moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.20,1.21 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/01 14:27:10 1.20 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/30 17:23:16 1.21 @@ -141,6 +141,7 @@ datatypes = datatypesMapByURL.get(dataDefURL); if(datatypes == null){ System.err.println("Fetching data type ontology from " + dataDefURL); + (new Exception("Trace for "+className)).printStackTrace(); loadDataTypes(dataDefURL, reg); System.err.println(" ... done"); datatypes = datatypesMapByURL.get(dataDefURL); From gordonp at dev.open-bio.org Fri Nov 30 12:23:17 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:23:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301723.lAUHNHms002957@dev.open-bio.org> gordonp Fri Nov 30 12:23:16 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv2857/src/main/org/biomoby/shared/data Modified Files: MobyDataBoolean.java MobyDataComposite.java MobyDataDateTime.java MobyDataFloat.java MobyDataInt.java MobyDataObject.java MobyDataString.java Log Message: Fixed missing passing of the registry to c-tors, which caused incorrect use of default registry for DOM-based object building moby-live/Java/src/main/org/biomoby/shared/data MobyDataBoolean.java,1.5,1.6 MobyDataComposite.java,1.19,1.20 MobyDataDateTime.java,1.10,1.11 MobyDataFloat.java,1.8,1.9 MobyDataInt.java,1.7,1.8 MobyDataObject.java,1.20,1.21 MobyDataString.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBoolean.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/MobyDataBoolean.java 2007/06/09 18:14:33 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBoolean.java 2007/11/30 17:23:16 1.6 @@ -30,7 +30,7 @@ public MobyDataBoolean(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -43,7 +43,7 @@ /** Every c-tor eventually winds up here */ public MobyDataBoolean(String articleName, Boolean b, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYBOOLEAN, registry)); value = b; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/10/31 15:35:55 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/11/30 17:23:16 1.20 @@ -40,7 +40,7 @@ public MobyDataComposite(org.w3c.dom.Element element, Registry registry) throws MobyException{ this(MobyDataType.getDataType(element.getLocalName(), registry), getName(element), - getNamespace(element), + getNamespace(element, registry), getId(element)); if(getDataType() == null){ throw new MobyException("Attempted to build a composite MOBY object from XML, " + @@ -75,7 +75,7 @@ " does not have an article " + "name, which is required (tag "+element.getNodeName()+")"); } - MobyDataObject childObject = (MobyDataObject) createInstanceFromDOM(child); + MobyDataObject childObject = (MobyDataObject) createInstanceFromDOM(child, registry); if(childObject == null){ throw new MobyException("The object member '" + fieldName + "' for object '"+ getName() + " could not be properly parsed into a MOBY object"); @@ -86,7 +86,7 @@ } public MobyDataComposite(MobyDataType type, String name, MobyNamespace namespace, String id){ - super(namespace.getName(), id); + super(namespace.getName(), id, type.getRegistry()); setName(name); setDataType(type); members = new ConcurrentHashMap(); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java 2007/06/09 18:14:33 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java 2007/11/30 17:23:16 1.11 @@ -41,7 +41,7 @@ public MobyDataDateTime(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -53,7 +53,7 @@ } public MobyDataDateTime(String articleName, String stringISO8601, Registry registry) throws IllegalArgumentException{ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYDATETIME, registry)); value = parseISO8601(stringISO8601.trim()); } @@ -67,7 +67,7 @@ } public MobyDataDateTime(String articleName, GregorianCalendar cal, Registry registry){ - super(articleName, ""); + super(articleName, "", registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYDATETIME, registry)); value = cal; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java 2007/06/09 18:14:33 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java 2007/11/30 17:23:16 1.9 @@ -34,7 +34,7 @@ public MobyDataFloat(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -46,7 +46,7 @@ } public MobyDataFloat(String articleName, Number n, Registry r){ - super(articleName); + super(articleName, r); setDataType(MobyDataType.getDataType(MobyTags.MOBYFLOAT, r)); if(n instanceof BigDecimal){ value = (BigDecimal) n; @@ -100,7 +100,7 @@ } public MobyDataFloat(String articleName, String stringNumber, Registry registry) throws NumberFormatException{ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYFLOAT, registry)); value = new BigDecimal(stringNumber.trim()); } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java 2007/06/09 18:14:33 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java 2007/11/30 17:23:16 1.8 @@ -33,7 +33,7 @@ public MobyDataInt(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -46,7 +46,7 @@ } public MobyDataInt(String articleName, Number n, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry)); if(n instanceof BigInteger){ value = (BigInteger) n; @@ -76,7 +76,7 @@ } public MobyDataInt(String articleName, int i, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry)); value = new BigInteger(""+i); } @@ -95,7 +95,7 @@ } public MobyDataInt(String articleName, String stringNumber, Registry registry) throws NumberFormatException{ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry)); value = new BigInteger(stringNumber.trim()); } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/10/31 15:35:55 1.20 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/11/30 17:23:16 1.21 @@ -175,7 +175,7 @@ "instance to create"); } - return createInstanceFromDOM(elementChild); + return createInstanceFromDOM(elementChild, registry); } // There are six types of objects we can populate with data directly @@ -208,7 +208,7 @@ else{ MobyDataType type = MobyDataType.getDataType(objectClass, registry); // Treat base64-encoded binary data as a special case, as we have a convenience class for it - if(type != null && type.inheritsFrom(MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE))){ + if(type != null && type.inheritsFrom(MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE, registry))){ return new MobyDataBytes(objectTag, registry); } else{ @@ -238,11 +238,16 @@ } protected static MobyNamespace getNamespace(Element e){ + return getNamespace(e, null); + } + + protected static MobyNamespace getNamespace(Element e, Registry registry){ String namespace = MobyPrefixResolver.getAttr(e, "namespace"); - MobyNamespace nsObj = MobyNamespace.getNamespace(namespace); + MobyNamespace nsObj = MobyNamespace.getNamespace(namespace, registry); if(nsObj == null){ // Not in the ontology, so create a token namespace nsObj = new MobyNamespace(namespace == null ? "" : namespace); + nsObj.setRegistry(registry); } return nsObj; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/07/23 21:32:58 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/11/30 17:23:16 1.8 @@ -29,7 +29,7 @@ public MobyDataString(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -41,7 +41,7 @@ } public MobyDataString(String articleName, CharSequence stringValue, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYSTRING, registry)); value = stringValue == null ? null : new StringBuffer(stringValue.toString()); } From gordonp at dev.open-bio.org Fri Nov 30 12:35:05 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:35:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301735.lAUHZ5ol003055@dev.open-bio.org> gordonp Fri Nov 30 12:35:05 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv3019/src/main/org/biomoby/shared Modified Files: MobyDataType.java Log Message: Removed verbosity moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.21,1.22 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/30 17:23:16 1.21 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/30 17:35:05 1.22 @@ -141,7 +141,6 @@ datatypes = datatypesMapByURL.get(dataDefURL); if(datatypes == null){ System.err.println("Fetching data type ontology from " + dataDefURL); - (new Exception("Trace for "+className)).printStackTrace(); loadDataTypes(dataDefURL, reg); System.err.println(" ... done"); datatypes = datatypesMapByURL.get(dataDefURL); From gordonp at dev.open-bio.org Fri Nov 30 12:42:15 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:42:15 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301742.lAUHgF6w003121@dev.open-bio.org> gordonp Fri Nov 30 12:42:15 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv3085/src/main/org/biomoby/shared/data Modified Files: MobyDataBytes.java Log Message: Fixed bug where registry wasn't being passed to namespace fetching in DOM-based c-tor moby-live/Java/src/main/org/biomoby/shared/data MobyDataBytes.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.java 2007/06/07 23:58:15 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.java 2007/11/30 17:42:15 1.8 @@ -41,7 +41,7 @@ public MobyDataBytes(org.w3c.dom.Element element, Registry registry) throws MobyException{ super(MobyDataType.getDataType(BASE64_DATATYPE, registry), getName(element)); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); MobyDataType inputDataType = MobyDataType.getDataType(element.getLocalName(), registry); if(!inputDataType.inheritsFrom(MobyDataType.getDataType(BASE64_DATATYPE, registry))){ From gordonp at dev.open-bio.org Fri Nov 30 19:37:01 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 19:37:01 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200712010037.lB10b18X003657@dev.open-bio.org> gordonp Fri Nov 30 19:37:01 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv3621/src/main/org/biomoby/shared/data Modified Files: MobyDataObject.java Log Message: Added missing registry param to getNamespace call moby-live/Java/src/main/org/biomoby/shared/data MobyDataObject.java,1.21,1.22 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/11/30 17:23:16 1.21 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/12/01 00:37:01 1.22 @@ -53,7 +53,7 @@ } public MobyDataObject(Element element, Registry registry) throws MobyException{ - this(getNamespace(element).getName(), getId(element), registry); + this(getNamespace(element, registry).getName(), getId(element), registry); setName(getName(element)); } From gordonp at dev.open-bio.org Fri Nov 30 20:26:10 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 20:26:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200712010126.lB11QAbt003792@dev.open-bio.org> gordonp Fri Nov 30 20:26:10 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv3752/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java MobyDataObjectVector.java Log Message: Added missing registry param to vector instantiation moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.20,1.21 MobyDataObjectVector.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.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/11/30 17:23:16 1.20 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/12/01 01:26:09 1.21 @@ -468,7 +468,7 @@ if(relationshipType == Central.iHAS){ // If we got here, there was a previous single value, and the field should be a list - MobyDataObjectVector HASList = new MobyDataObjectVector(""); + MobyDataObjectVector HASList = new MobyDataObjectVector("", getDataType().getRegistry()); // Replaces old single value members.put(fieldName, HASList); HASList.add(existingMember); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectVector.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/MobyDataObjectVector.java 2007/06/26 21:25:04 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectVector.java 2007/12/01 01:26:10 1.4 @@ -3,6 +3,7 @@ import java.util.*; +import org.biomoby.registry.meta.Registry; import org.biomoby.shared.Central; import org.biomoby.shared.MobyDataType; import org.biomoby.shared.MobyException; @@ -24,11 +25,19 @@ * Builds a vector with an initial capacity of 5. */ public MobyDataObjectVector(String name){ - this(name, 5); + this(name, null); + } + + public MobyDataObjectVector(String name, Registry registry){ + this(name, 5, registry); } public MobyDataObjectVector(String name, int initialCapacity){ - super(name); + this(name, initialCapacity, null); + } + + public MobyDataObjectVector(String name, int initialCapacity, Registry registry){ + super(name, registry); members = new Vector(initialCapacity); } From gordonp at dev.open-bio.org Fri Nov 30 20:33:03 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 20:33:03 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200712010133.lB11X3fg003858@dev.open-bio.org> gordonp Fri Nov 30 20:33:03 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv3822/src/main/org/biomoby/shared Modified Files: MobyDataType.java Log Message: Fixed error message typo service -> data moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.22,1.23 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.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/shared/MobyDataType.java 2007/11/30 17:35:05 1.22 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/12/01 01:33:03 1.23 @@ -148,7 +148,7 @@ } catch(Exception e){ - System.err.println("Cannot parse MOBY Service Type Ontology: " + e); + System.err.println("Cannot parse MOBY Data Type Ontology: " + e); e.printStackTrace(); return null; } From gordonp at dev.open-bio.org Thu Nov 1 14:27:10 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 1 Nov 2007 10:27:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200711011427.lA1ERAwj031837@dev.open-bio.org> gordonp Thu Nov 1 10:27:10 EDT 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv31801/src/main/org/biomoby/shared Modified Files: MobyDataType.java Log Message: Fixed registry propagation moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/08/24 09:35:27 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/01 14:27:10 1.20 @@ -284,7 +284,7 @@ public MobyDataType getParent(){ String parentName = getParentName(); - return parentName == null || parentName.length() == 0 ? null : getDataType(parentName); + return parentName == null || parentName.length() == 0 ? null : getDataType(parentName, getRegistry()); } /** From mwilkinson at dev.open-bio.org Wed Nov 7 17:09:24 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 7 Nov 2007 12:09:24 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711071709.lA7H9Oaf014965@dev.open-bio.org> mwilkinson Wed Nov 7 12:09:23 EST 2007 Update of /home/repository/moby/moby-live/Docs In directory dev.open-bio.org:/tmp/cvs-serv14946 Modified Files: BioMoby_After_Review.pdf Log Message: updating the CVS version of the rejected manuscript. moby-live/Docs BioMoby_After_Review.pdf,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 Binary files /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf 2007/08/03 21:52:21 1.1 and /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf 2007/11/07 17:09:23 1.2 differ rcsdiff: /home/repository/moby/moby-live/Docs/BioMoby_After_Review.pdf: diff failed From kawas at dev.open-bio.org Wed Nov 7 18:04:56 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 Nov 2007 13:04:56 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711071804.lA7I4uvI015058@dev.open-bio.org> kawas Wed Nov 7 13:04:55 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/lsid/authority In directory dev.open-bio.org:/tmp/cvs-serv15023 Modified Files: MobyMetadataResolver.pm Log Message: updated this module to include a getData call for service instances. Should probably move it to a different module considering the name of the this module suggests methods for metadata resolution moby-live/Perl/MOBY/lsid/authority MobyMetadataResolver.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/lsid/authority/MobyMetadataResolver.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/lsid/authority/MobyMetadataResolver.pm 2007/07/17 17:25:39 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/lsid/authority/MobyMetadataResolver.pm 2007/11/07 18:04:55 1.2 @@ -654,7 +654,8 @@ use LS::ID; use LS::Service::Response; use LS::Service::Fault; - +use MOBY::Client::Service; +use MOBY::Client::Central; use MOBY::Config; use MOBY::RDF::Ontologies::Services; @@ -704,6 +705,102 @@ } #----------------------------------------------------------------- +# getData +#----------------------------------------------------------------- + +=head2 getData + +This subroutine is the handler that actually performs +the action when getData is called on an LSID under this namespace + +This routine has 2 parameters: + lsid - the LSID + format - output format + + Example: getData(LS::ID->new('urn:lsid:authority:namespace:object')); + +A LS::Service::Response is returned if getData is successful. + +=cut + +sub getData { + + my ( $self, $lsid, $format ) = @_; + $lsid = $lsid->canonical(); + my $length = length( $lsid->object() ); + + # some error conditions + return LS::Service::Fault->fault('malformed LSID') unless $length > 0; + return LS::Service::Fault->fault('malformed LSID') + unless index( $lsid->object(), ',' ) > 0; + + my $servicename = + substr( $lsid->object(), index( $lsid->object(), ',' ) + 1, $length ); + my $authURI = substr( $lsid->object(), 0, index( $lsid->object(), ',' ) ); + + return LS::Service::Fault->fault('Unknown LSID') + unless ( + $self->lsidExists( + $lsid->namespace, $lsid->object, $lsid->revision + ) + ); + + my $latest = + $self->isLatest( $lsid->namespace, $lsid->object, + $lsid->revision ); + do { + my $data = MOBY::RDF::Ontologies::Services->new; + $format = 'application/xml' if ( !$format ); + my $wsdl = $self->_getServiceWSDL($authURI, $servicename); + print STDERR $wsdl; + return LS::Service::Response->new( + response => $wsdl, + format => $format + ); + } unless $latest; + + return LS::Service::Fault->serverFault( 'Unable to load Data', 600 ) + if ( $latest eq "" ); + + $format = 'text/plain'; + return LS::Service::Response->new( + response => "", + format => $format + ); + + +} +#----------------------------------------------------------------- +# _getServiceWSDL +#----------------------------------------------------------------- + +=head2 _getServiceWSDL + +This subroutine obtains the wsdl for moby services given the name/auth +combination. It uses the registry that is set in the enviroment. +TODO - might have to change this behaviour, if we think of a good +reason! + +=cut + +sub _getServiceWSDL { + my ( $self, $authority, $servicename ) = @_; + my $moby = MOBY::Client::Central->new(); + my ( $services, $RegObject ) = $moby->findService( + authURI => $authority, + serviceName => $servicename + ); + unless ($services && @{$services}[0] ) { + return ""; + }; + # should only be one ... + foreach my $ServiceInstance ( @{ $services } ) { + return $moby->retrieveService($ServiceInstance); + } + return "" +} + +#----------------------------------------------------------------- # getMetadata #----------------------------------------------------------------- From kawas at dev.open-bio.org Wed Nov 7 18:06:38 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 Nov 2007 13:06:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711071806.lA7I6cmn015101@dev.open-bio.org> kawas Wed Nov 7 13:06:38 EST 2007 Update of /home/repository/moby/moby-live/Perl/scripts In directory dev.open-bio.org:/tmp/cvs-serv15066 Modified Files: authority.pl Log Message: added code to allow for the data resolution of service instances moby-live/Perl/scripts authority.pl,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/authority.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/scripts/authority.pl 2007/08/14 23:28:09 1.2 +++ /home/repository/moby/moby-live/Perl/scripts/authority.pl 2007/11/07 18:06:38 1.3 @@ -1,167 +1,185 @@ -#!/usr/bin/perl -w -#----------------------------------------------------------------- -# authority.pl -# Author: Edward Kawas , -# For copyright and disclaimer see below. -# -# $Id$ -#----------------------------------------------------------------- - -use strict; -use warnings; - -use MOBY::lsid::authority::MobyMetadataResolver; - -use LS::ID; - -use LS::Service::Fault; -use LS::Service::Response; -use LS::Service::Authority; -use LS::Service::Namespace; -use LS::Service::DataService; -use LS::Service::AdvancedDataService; - -use LS::HTTP::Service; -use LS::RDF::SimpleDocument; - -# -# The SOAP service will travel over HTTP to this mod_perl based -# authority where all of the SOAP messages are decoded and -# passed up the SOAP stack until they reach this framework -# -# UNTESTED: The package defaults to HTTP:CGI which works in most -# cases. -# -#use LS::SOAP::Service transport=> 'HTTP::Apache'; -use LS::SOAP::Service transport => 'HTTP::CGI'; - -############## - -my $location = 'http://'; - -# TODO get this from the mobyconfig file -if ( $ENV{'HTTP_HOST'} ) { - - $location .= $ENV{'HTTP_HOST'}; -} -else { - - # Set this to the default hostname for the authority - $location .= 'localhost:8080'; -} - -# Create the authority service -my $authority = LS::Service::Authority->new( - name => 'BioMOBY', - authority => 'biomoby.org', - location => $location, - getAvailableServices => \&dynamic_ops -); - -# -# Add two ports to the authority: -# -# 1. A HTTP Location for the metadata -# -# 2. A SOAP location for the metadata -# - -my $port; - -$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( - portName=> 'BioMOBYSoapPort', - endpoint=> "$location/authority/metadata", - protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP, - ); -$authority->addPort(serviceName=> 'BioMOBY', port=> $port); - -$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( - portName=> 'BioMOBYHttpPort', - endpoint=> "$location/authority/metadata", - protocol=> $LS::Authority::WSDL::Constants::Protocols::HTTP, - ); -$authority->addPort(serviceName=> 'BioMOBY', port=> $port); - - - -# Add the metadata service with namespaces - -# we will handle 4 namespaces ... namespacetype, serviceinstance, servicetype and objectclass. -#TODO add the other predicates ... -my $metadata = LS::Service::DataService->new(); -$metadata->addNamespace( MobyNamespaceType->new() ); -$metadata->addNamespace( MobyServiceInstance->new() ); -$metadata->addNamespace( MobyServiceType->new() ); -$metadata->addNamespace( MobyObjectClass->new() ); - -my $moby_authority_service = LS::SOAP::Service->new(); - -$moby_authority_service->metadata_service($metadata); -$moby_authority_service->data_service($metadata); -$moby_authority_service->authority_service($authority); - -# -# Create a HTTP service and instruct the SOAP service to -# accept HTTP queries -# -my $moby_http_service = LS::HTTP::Service->new(); -$moby_http_service->dispatch_authority_to($authority); -$moby_http_service->dispatch_metadata_to($metadata); - -$moby_authority_service->http_server($moby_http_service); - -$moby_authority_service->dispatch(); - -# -# This adds a HTTP/CGI metadata port to the returned WSDL for each valid -# LSID -# -sub dynamic_ops { - -# if the namespace is serviceinstance, get the signatureURL and add it as a location - my ( $lsid, $wsdl ) = @_; - my %valid_namespaces = ( - "namespacetype" => 1, - "serviceinstance" => 1, - "objectclass" => 1, - "servicetype" => 1 - ); - my $namespace = $lsid->namespace(); - my $object = $lsid->object(); - - return LS::Service::Fault->fault('Unknown LSID') - unless ( $valid_namespaces{$namespace} ); - -# need to decide whether or not i should check exisitence here as well as in the MobyMetadataResolver.pm ... - my $port; - - do { - my $length = length($object); - # some error conditions - if ( $length > 0 and index( $object, ',' ) > 0 ) { - my $servicename = - substr( $object, index( $object, ',' ) + 1, $length ); - my $authURI = substr( $object, 0, index( $object, ',' ) ); - - my $moby = MOBY::Client::Central->new(); - my ( $services, $RegObject ) = $moby->findService( - authURI => $authURI, - serviceName => $servicename - ); - foreach my $SI (@$services) { - #should only be one of them ... - $port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( - portName => 'HTTPMetadata', - endpoint => $SI->signatureURL, - protocol => $LS::Authority::WSDL::Constants::Protocols::HTTP, - ); - $wsdl->addPort( - serviceName => 'ServiceProviderMetadataHTTPPort', - port => $port - ); - } - } - } if ( $namespace eq 'serviceinstance' ); - return $wsdl; -} -__END__ +#!/usr/bin/perl -w +#----------------------------------------------------------------- +# authority.pl +# Author: Edward Kawas , +# For copyright and disclaimer see below. +# +# $Id$ +#----------------------------------------------------------------- + +use strict; +use warnings; + +use MOBY::lsid::authority::MobyMetadataResolver; + +use LS::ID; + +use LS::Service::Fault; +use LS::Service::Response; +use LS::Service::Authority; +use LS::Service::Namespace; +use LS::Service::DataService; +use LS::Service::AdvancedDataService; + +use LS::HTTP::Service; +use LS::RDF::SimpleDocument; + +# +# The SOAP service will travel over HTTP to this mod_perl based +# authority where all of the SOAP messages are decoded and +# passed up the SOAP stack until they reach this framework +# +# UNTESTED: The package defaults to HTTP:CGI which works in most +# cases. +# +#use LS::SOAP::Service transport=> 'HTTP::Apache'; +use LS::SOAP::Service transport => 'HTTP::CGI'; + +############## + +my $location = 'http://'; + +# TODO get this from the mobyconfig file +if ( $ENV{'HTTP_HOST'} ) { + + $location .= $ENV{'HTTP_HOST'}; +} +else { + + # Set this to the default hostname for the authority + $location .= 'localhost:8080'; +} + +# Create the authority service +my $authority = LS::Service::Authority->new( + name => 'BioMOBY', + authority => 'biomoby.org', + location => $location, + getAvailableServices => \&dynamic_ops +); + +# +# Add two ports to the authority: +# +# 1. A HTTP Location for the metadata +# +# 2. A SOAP location for the metadata +# +# 3. A HTTP Location for the data +# +# 4. A SOAP location for the data +# + +my $port; + +$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( + portName=> 'BioMOBYSoapPort', + endpoint=> "$location/authority/metadata", + protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP, + ); +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); + +$port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( + portName=> 'BioMOBYHttpPort', + endpoint=> "$location/authority/metadata", + protocol=> $LS::Authority::WSDL::Constants::Protocols::HTTP, + ); +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); + +#data ports +$port = LS::Authority::WSDL::Simple::DataPort->newData( + portName=> 'BioMOBYHttpPort', + endpoint=> "$location/authority/data", + protocol=> $LS::Authority::WSDL::Constants::Protocols::HTTP, + ); + +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); +$port = LS::Authority::WSDL::Simple::DataPort->newData( + portName=> 'BioMOBYSoapPort', + endpoint=> "$location/authority/data", + protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP, + ); +$authority->addPort(serviceName=> 'BioMOBY', port=> $port); + + +# Add the metadata service with namespaces + +# we will handle 4 namespaces ... namespacetype, serviceinstance, servicetype and objectclass. +#TODO add the other predicates ... +my $metadata = LS::Service::DataService->new(); +$metadata->addNamespace( MobyNamespaceType->new() ); +$metadata->addNamespace( MobyServiceInstance->new() ); +$metadata->addNamespace( MobyServiceType->new() ); +$metadata->addNamespace( MobyObjectClass->new() ); + +my $moby_authority_service = LS::SOAP::Service->new(); + +$moby_authority_service->metadata_service($metadata); +$moby_authority_service->data_service($metadata); +$moby_authority_service->authority_service($authority); + +# +# Create a HTTP service and instruct the SOAP service to +# accept HTTP queries +# +my $moby_http_service = LS::HTTP::Service->new(); +$moby_http_service->dispatch_authority_to($authority); +$moby_http_service->dispatch_metadata_to($metadata); + +$moby_authority_service->http_server($moby_http_service); + +$moby_authority_service->dispatch(); + +# +# This adds a HTTP/CGI metadata port to the returned WSDL for each valid +# LSID +# +sub dynamic_ops { + +# if the namespace is serviceinstance, get the signatureURL and add it as a location + my ( $lsid, $wsdl ) = @_; + my %valid_namespaces = ( + "namespacetype" => 1, + "serviceinstance" => 1, + "objectclass" => 1, + "servicetype" => 1 + ); + my $namespace = $lsid->namespace(); + my $object = $lsid->object(); + + return LS::Service::Fault->fault('Unknown LSID') + unless ( $valid_namespaces{$namespace} ); + +# need to decide whether or not i should check exisitence here as well as in the MobyMetadataResolver.pm ... + my $port; + + do { + my $length = length($object); + # some error conditions + if ( $length > 0 and index( $object, ',' ) > 0 ) { + my $servicename = + substr( $object, index( $object, ',' ) + 1, $length ); + my $authURI = substr( $object, 0, index( $object, ',' ) ); + + my $moby = MOBY::Client::Central->new(); + my ( $services, $RegObject ) = $moby->findService( + authURI => $authURI, + serviceName => $servicename + ); + foreach my $SI (@$services) { + #should only be one of them ... + $port = LS::Authority::WSDL::Simple::MetadataPort->newMetadata( + portName => 'HTTPMetadata', + endpoint => $SI->signatureURL, + protocol => $LS::Authority::WSDL::Constants::Protocols::HTTP, + ); + $wsdl->addPort( + serviceName => 'ServiceProviderMetadataHTTPPort', + port => $port + ); + } + } + } if ( $namespace eq 'serviceinstance' ); + return $wsdl; +} +__END__ From pieter at dev.open-bio.org Wed Nov 21 16:29:19 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Wed, 21 Nov 2007 11:29:19 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711211629.lALGTJDm031739@dev.open-bio.org> pieter Wed Nov 21 11:29:18 EST 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv31692 Modified Files: InformationBlocks.html MessageStructure.html MobyCentralObjects.html XMLPayloads.html Added Files: Authorities.html Log Message: Added documentation on Authorities and their URIs. moby-live/Docs/MOBY-S_API Authorities.html,NONE,1.1 InformationBlocks.html,1.8,1.9 MessageStructure.html,1.11,1.12 MobyCentralObjects.html,1.10,1.11 XMLPayloads.html,1.20,1.21 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/InformationBlocks.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/InformationBlocks.html 2007/02/22 16:22:24 1.8 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/InformationBlocks.html 2007/11/21 16:29:18 1.9 @@ -105,13 +105,13 @@
        • id: This is the ID within that namespace (as in the base Object)
        • -
        • authURI: the Authority of a service provider who can execute an +
        • authURI: the Authority of a service provider who can execute an appropriate service on the piece of data referred to by this cross-reference such that the intent of the cross-reference will be realized.
        • serviceName: the name of the MOBY Service provided by that -Authority that does the appropriate transaction.
        • +Authority that does the appropriate transaction.
        • xrefType: a term indicating the semantic type of this cross-reference.
        • @@ -129,7 +129,8 @@

          All components are required, with the exception of the human readable description. The namespace and id attributes fulfil the same role as -their counterparts in the Object style cross-reference. The authURI +their counterparts in the Object style cross-reference. +The authURI and serviceName components together act as a unique identifier to a particular MOBY Service that the current service provider suggests you execute using this cross-reference (namespace/id) in order to =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MessageStructure.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MessageStructure.html 2006/11/21 23:04:27 1.11 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MessageStructure.html 2007/11/21 16:29:18 1.12 @@ -84,8 +84,8 @@

          -This is regardless of the URI for the service provider! This is -useful because the same service might be available from several +This is regardless of the URI for the service provider! +This is useful because the same service might be available from several providers. If they all use the same URI, then a computer (or human) can infer that they are equivalent, and swap one for the other, based on availability, or other criteria. @@ -107,7 +107,7 @@ <Category>moby</Category> <serviceName>retrieveSequence</serviceName> <serviceType>Retrieve</serviceType> - <authURI>services.serviceprovider.org</authURI> + <authURI>services.serviceprovider.org</authURI> <URL>http://serviceprovider.org/getService.pl</URL>; <contactEmail>markw at illuminae.com</contactEmail> <authoritativeService>0</authoritativeService> =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2007/02/22 16:22:24 1.10 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2007/11/21 16:29:18 1.11 @@ -94,7 +94,7 @@ To query MOBY Central, you fill out the relevant elements of a Query Ojbect. These include the input and/or output data Classes (by name from the Class ontology), the Service-type (by name from the -Service-type ontology), the authority (service provider URI), or any +Service-type ontology), the authority (service provider URI), or any number of keywords that must appear in the service description.

            @@ -167,7 +167,7 @@ </outputObjects> <serviceType>ServiceTypeTerm</serviceType> <Category>moby</Category> - <authURI>desired.service.provider</authURI> + <authURI>desired.service.provider</authURI> <signatureURL>http://location.to/service/description</signatureURL> <serviceName>MyServiceName</serviceName>; <expandObjects>1|0</expandObjects> @@ -194,7 +194,7 @@
              <Services>
            -   <Service authURI="authority.URI.here" serviceName="MyService" 
            +   <Service authURI="authority.URI.here" serviceName="MyService" 
             	         lsid='urn:lsid:authority.uri:serviceinstance:id'>
                  <serviceType lsid='urn:lsid:authority.uri:servicetype:OntologyTerm'>
             	       Ontology_Term
            @@ -220,9 +220,9 @@
              </Services>
             
            -The "Service" XML element, contains the attributes of authority URI +The "Service" XML element, contains the attributes of authority URI (authURI), service name (serviceName), and the LSID representing the -service instance; the combination of authURI and serviceName is +service instance; the combination of authURI and serviceName is sufficient to unambiguously describe any MOBY service instance in a MOBY Central registry. Thus these are used to retrieve the service definition using the MOBY Central retrieveService procedure =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/XMLPayloads.html,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/XMLPayloads.html 2007/06/07 15:30:01 1.20 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/XMLPayloads.html 2007/11/21 16:29:18 1.21 @@ -242,7 +242,7 @@ currently only 'moby' services are fully supported --> <serviceName>YourServiceNameHere</serviceName> <serviceType>TypeOntologyTerm</serviceType> - <authURI>your.URI.here</authURI> + <authURI>your.URI.here</authURI> <signatureURL> http://some.URL.org/path/to/RDF/file </signatureURL> <URL>http://URL.to.your/Service.script</URL>; <contactEmail>your_name at contact.address.com</contactEmail> @@ -293,11 +293,11 @@
            • If that RDF document contains a new Signature RDF, that new service (if valid) will be registered
              • -
              • An new service is recognized by the presence of a novel authorityURI + serviceName (predicates dc:publisher and mygrid:hasServiceNameText) in a mygrid:serviceDescription block of the Signature RDF document
              • +
              • An new service is recognized by the presence of a novel authorityURI + serviceName (predicates dc:publisher and mygrid:hasServiceNameText) in a mygrid:serviceDescription block of the Signature RDF document
            • If the retrieved RDF document contains a modified Signature RDF, the currently-registered service will be updated in MOBY Central
              • -
              • An updated service is recognized by the presence of a known authorityURI + serviceName in a Signature RDF service description, where other parameters have been altered compared to what is in the MOBY Central registry
              • +
              • An updated service is recognized by the presence of a known authorityURI + serviceName in a Signature RDF service description, where other parameters have been altered compared to what is in the MOBY Central registry
              • uncertain: the Agent will refuse to modify the service if you do not also modify your service's LSID.
            • If a Signature RDF is missing from the document, the service formerly described by that RDF will be deregistered from MOBY Central
            • @@ -381,7 +381,7 @@

              Input XML

                       <retrieveService>
              -            <Service authURI="authority.URI.here" serviceName="MyService"/>          
              +            <Service authURI="your.URI.here" serviceName="MyService"/>          
                       </retrieveService>
               
              @@ -390,7 +390,7 @@
              • moby
                -         <Service authURI="authority.URI.here" serviceName="MyService" 
                +         <Service authURI="your.URI.here" serviceName="MyService" 
                 	 lsid='urn:lsid:authority.uri:serviceinstance:id'>
                               <![CDATA[WSDL document here]]>
                          </Service>
                @@ -420,7 +420,7 @@
                 

                Notes

                  -
                • AuthURI and serviceName attributes are +
                • authURI and serviceName attributes are sufficient to identify a unique service, and both are required in the element.
                • @@ -450,7 +450,7 @@

                  Output XML

                           <serviceProviders>
                  -           <serviceProvider name="authority.URI.here"/>
                  +           <serviceProvider name="your.URI.here"/>
                                   ...
                           </serviceProviders>
                   
                  @@ -483,7 +483,7 @@

                  Output XML

                           <serviceNames>
                  -           <serviceName name="serviceName" authURI='authority.info.here' 
                  +           <serviceName name="serviceName" authURI="your.URI.here" 
                   	   lsid='urn:lsid:authority.uri:namespace:id'/>
                                   ...
                           </serviceNames>
                  @@ -492,9 +492,9 @@
                   
                  • Retrieves minimal information about all registered MOBY services
                    • -
                    • serviceName -
                    • authority -
                    • service instance LSID +
                    • Name
                    • +
                    • Authority
                    • +
                    • LSID
                  @@ -509,7 +509,7 @@ <serviceType name="serviceName" lsid='urn:lsid:authority.uri:servicetype:id'> <Description><![CDATA[free text description here]]></Description> <contactEmail>email at address here</contactEmail> - <authURI>authority.uri.here</authURI> + <authURI>your.URI.here</authURI> </serviceType> ... </serviceTypes> @@ -575,7 +575,7 @@ <objectType articleName="SomeName" lsid='urn:lsid:authority.uri:namespace:id'>ExistingObjectType</objectType> </Relationship> ... - <authURI>owner.URI.here</authURI> + <authURI>your.URI.here</authURI> <contactEmail>owner at their.address.com</contactEmail> </retrieveObjectDefinition>
                  @@ -596,7 +596,7 @@ <Namespace name="namespace" lsid='urn:lsid:authority.uri:namespace:id'> <Description><![CDATA[free text description here]]></Description> <contactEmail>email at address here</contactEmail> - <authURI>authority.uri.here</authURI> + <authURI>your.URI.here</authURI> </Namespace> ... </Namespaces> @@ -743,7 +743,7 @@ ... </Relationship> ... - <authURI>Your.URI.here</authURI> + <authURI>your.URI.here</authURI> <contactEmail>You at your.address.com</contactEmail> </registerObjectClass>
                @@ -825,7 +825,7 @@ <registerServiceType> <serviceType>NewServiceType</serviceType> <contactEmail>your_name at contact.address.com</contactEmail> - <authURI>Your.URI.here</authURI> + <authURI>your.URI.here</authURI> <Description> <![CDATA[ human description of service type here]]> </Description> @@ -891,7 +891,7 @@ <registerNamespace> <namespaceType>NewNamespaceHere</namespaceType> <contactEmail>your_name at contact.address.com</contactEmail> - <authURI>Your.URI.here</authURI> + <authURI>your.URI.here</authURI> <Description> <![CDATA[human readable description]]> </Description> From pieter at dev.open-bio.org Thu Nov 22 17:42:38 2007 From: pieter at dev.open-bio.org (Pieter Neerincs) Date: Thu, 22 Nov 2007 12:42:38 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711221742.lAMHgcsA004564@dev.open-bio.org> pieter Thu Nov 22 12:42:37 EST 2007 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv4529 Modified Files: Authorities.html Log Message: fixed erroneous relative links in Authorities.html moby-live/Docs/MOBY-S_API Authorities.html,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/Authorities.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/Authorities.html 2007/11/21 16:29:18 1.1 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/Authorities.html 2007/11/22 17:42:37 1.2 @@ -153,53 +153,52 @@

                Other parts of MOBY-S API

              • Categories

                @@ -225,7 +224,8 @@
              • Meta

              • From kawas at dev.open-bio.org Mon Nov 26 22:49:04 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 26 Nov 2007 17:49:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262249.lAQMn4Sc018150@dev.open-bio.org> kawas Mon Nov 26 17:49:03 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv18115/RDF/Ontologies Modified Files: Services.pm Log Message: split up findservice calls that want all services into many calls by service provider. moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/08/23 17:48:28 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/26 22:49:03 1.5 @@ -118,10 +118,24 @@ my $authURI = $hash->{authURI} || ''; my $name = $hash->{serviceName} || ''; my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; + my $services = []; + my $RegObject; + + if ($name ne '' or $authURI ne '') { + my $moby = MOBY::Client::Central->new(); + ( $services, $RegObject ) = + $moby->findService( authURI => $authURI, serviceName => $name ); + + } else { + my $moby = MOBY::Client::Central->new(); + my ( @URIS ) = $moby->retrieveServiceProviders(); + foreach my $provider (@URIS) { + my ( $instances, $RegObject ) = + $moby->findService( authURI => $provider ); + push @$services, @$instances; + } - my $moby = MOBY::Client::Central->new(); - my ( $services, $RegObject ) = - $moby->findService( authURI => $authURI, serviceName => $name ); + } my $xml = $self->_createRDFModel( \@$services ); return new MOBY::RDF::Utils->prettyPrintXML( { xml => $xml } ) unless $prettyPrint eq 'no'; From mwilkinson at dev.open-bio.org Mon Nov 26 23:00:35 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 26 Nov 2007 18:00:35 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262300.lAQN0Zg7018279@dev.open-bio.org> mwilkinson Mon Nov 26 18:00:35 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv18260/MOBY Modified Files: Central.pm Log Message: Perl code now scraping current location of default MOBY Central from the 301 Redirect headers from biomoby.org moby-live/Perl/MOBY Central.pm,1.292,1.293 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.292 retrieving revision 1.293 diff -u -r1.292 -r1.293 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/10/22 20:52:56 1.292 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/11/26 23:00:35 1.293 @@ -96,7 +96,7 @@ CLIENT-SIDE use SOAP::Lite +autodispatch => - proxy => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', + proxy => 'http://moby.ucalgary.ca/moby/MOBY-Central.pl', # or whatever... on_fault => sub { my($soap, $res) = @_; die ref $res ? $res->faultstring : $soap->transport->status, "\n"; From mwilkinson at dev.open-bio.org Mon Nov 26 23:00:36 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 26 Nov 2007 18:00:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262300.lAQN0ak2018305@dev.open-bio.org> mwilkinson Mon Nov 26 18:00:35 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv18260/MOBY/Client Modified Files: Central.pm OntologyServer.pm Log Message: Perl code now scraping current location of default MOBY Central from the 301 Redirect headers from biomoby.org moby-live/Perl/MOBY/Client Central.pm,1.152,1.153 OntologyServer.pm,1.17,1.18 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.152 retrieving revision 1.153 diff -u -r1.152 -r1.153 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/09/14 17:23:47 1.152 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2007/11/26 23:00:35 1.153 @@ -143,12 +143,8 @@ ( Connections => [ undef, 'read/write' ], default_MOBY_servername => [ 'mobycentral', 'read/write' ], - default_MOBY_server => [ -'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', - 'read/write' - ], - default_MOBY_uri => - [ 'http://mobycentral.icapture.ubc.ca/MOBY/Central', 'read/write' ], + default_MOBY_server => [ '', 'read/write'], + default_MOBY_uri => [ 'http://biomoby.org/MOBY/Central', 'read/write' ], default_MOBY_proxy => [ undef, 'read/write' ], default_MOBY_type => [ 'soap', 'read/write' ], Registries => [ undef, 'read/write' ], @@ -263,7 +259,11 @@ } $self->Connections( [] ); # initialize; + my ($central, $ontologyserver) = _getDefaultCentral(); + $self->default_MOBY_server($central) if $central; + # if user has set up preferred servers, then use those by default + $self->default_MOBY_server( $ENV{MOBY_SERVER} ) if $ENV{MOBY_SERVER}; $self->default_MOBY_uri( $ENV{MOBY_URI} ) if $ENV{MOBY_URI}; $self->default_MOBY_type( $ENV{MOBY_TYPE} ) if $ENV{MOBY_TYPE}; @@ -358,6 +358,23 @@ return $self; } + +sub _getDefaultCentral { + + use LWP::UserAgent; + use HTTP::Request::Common qw(HEAD); + + my $ua = LWP::UserAgent->new; + my $req = HEAD 'http://biomoby.org/mobycentral'; + my $res = $ua->simple_request($req); + my $mobycentral = $res->header('location'); + + $req = HEAD 'http://biomoby.org/ontologyserver'; + $res = $ua->simple_request($req); + my $ontologyserver = $res->header('location'); + return ($mobycentral, $ontologyserver); +} + =head2 registerObject a.k.a registerObjectClass Usage : $REG = $MOBY->registerObject(%args) =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/01/25 17:15:13 1.17 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm 2007/11/26 23:00:35 1.18 @@ -85,10 +85,7 @@ #ATTRIBUTES my %_attr_data = # DEFAULT ACCESSIBILITY ( - host => [ - "http://mobycentral.icapture.ubc.ca/cgi-bin/OntologyServer.cgi", - 'read/write' - ], + host => ['' ,'read/write'], proxy => [ undef, 'read/write' ], ); @@ -126,11 +123,24 @@ $self->{$attrname} = $self->_default_for( $attrname ); } } - $self->host($ENV{MOBY_ONTOLOGYSERVER}) if ($ENV{MOBY_ONTOLOGYSERVER}); + my ($ontologyserver) = _getOntologyServer(); # get default from moby central + $self->host($ontologyserver) if $ontologyserver; + $self->host($ENV{MOBY_ONTOLOGYSERVER}) if ($ENV{MOBY_ONTOLOGYSERVER}); # override with user preference if set in their environment return undef unless $self->host; return $self; } + +sub _getOntologyServer { + use LWP::UserAgent; + use HTTP::Request::Common qw(HEAD); + my $ua = LWP::UserAgent->new; + my $req = HEAD 'http://biomoby.org/ontologyserver'; + my $res = $ua->simple_request($req); + my $ontologyserver = $res->header('location'); + return $ontologyserver; +} + =head2 objectExists =cut From mwilkinson at dev.open-bio.org Mon Nov 26 23:16:23 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 26 Nov 2007 18:16:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711262316.lAQNGNN6018421@dev.open-bio.org> mwilkinson Mon Nov 26 18:16:23 EST 2007 Update of /home/repository/moby/moby-live/Perl/t In directory dev.open-bio.org:/tmp/cvs-serv18398/t Modified Files: Client-OntologyServer.t Client-Central.t Log Message: make sure people know which regisry they are testing during the make test moby-live/Perl/t Client-OntologyServer.t,1.8,1.9 Client-Central.t,1.56,1.57 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2007/01/31 16:17:43 1.8 +++ /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t 2007/11/26 23:16:23 1.9 @@ -1,182 +1,182 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' - -# Note added by Frank Gibbons. -# Tests should, as far as possible, avoid the use of literals. -# If you register a service with authURI => mysite.com, -# and you want to test a retrieved description of the service, -# don't test that the service returns authURI eq "mysite.com", -# test so that it returns the same value as you used to register it in the first place. - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; -#use SOAP::Lite +trace; -use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details -use strict; -use MOBY::Client::OntologyServer; -use MOBY::Client::Central; -BEGIN { use_ok('MOBY::Client::OntologyServer'); - # initialize with a couple of useless things that we can guarantee to find - my $C = MOBY::Client::Central->new(); - - my %Namespace = ( namespaceType => 'Rub1', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - my $r = $C->registerNamespace( %Namespace ); - %Namespace = ( namespaceType => 'Rub2', - authURI => 'your.authority.URI', - description => "human readable description of namespace", - contactEmail => 'your at address.here' - ); - $r = $C->registerNamespace( %Namespace ); - my %ServiceType = ( serviceType => "Rub1", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType ); - %ServiceType = ( serviceType => "Rub2", - description => "a human-readable description of the service", - contactEmail => 'your at email.address', - authURI => "test.suite.com", - Relationships => { ISA => ['Service'] } - ); - $r = $C->registerServiceType( %ServiceType ); - }; - - -END { - # Define cleanup of registry, to return it to its 'pristine' state, - # so that later attempts to run tests don't run into problems caused - # by failure of these tests, or abortion of the test script. - # Reconnect to MOBY Central here, since other connections - # will have gone out of scope by the time we get to this END block. - # Also can't use %Obj, - my $C = MOBY::Client::Central->new(); - my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); - $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); - $r = $C->deregisterServiceType( serviceType => 'Rub1' ); - $r = $C->deregisterServiceType( serviceType => 'Rub2' ); - -}; - - -my @autoload = qw/host proxy/; -my @API = (@autoload, qw/new getUserAgent -objectExists serviceExists namespaceExists /); - -my $os = MOBY::Client::OntologyServer->new(); - -if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { - print STDERR <host,"\n\n\n"; -} - -foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. -can_ok("MOBY::Client::OntologyServer", @API) - or diag("OntologyServer doesn't implement full API"); - -# Check that accessor methods work correctly; -my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); -my ($new_host, $new_proxy) = ("foo.cgi", "bar"); -is($os->host($new_host), $new_host) or diag("Couldn't set new host"); -is($os->host(), $new_host) or diag("Couldn't get host"); -is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); - is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); - is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); -TODO: { - local $TODO = "How come I cant' set proxy back to its original value?"; - is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); -} - -# Start fresh.... -$os = MOBY::Client::OntologyServer->new(); - -my ($success, $msg, $existingURI); -my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid -foreach (@check_ns) { - ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); - is($success, 1) - or diag("Namespace '$_' reported erroneously as non-existent."); -} - -# Could get these allowed datatypes from MOBY::Config, -# except that module only works when you've got a local registry set up. -my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid -foreach (@check_obj) { - ($success, $msg, $existingURI) = $os->objectExists(term => $_); - is($success, 1) - or diag("Object '$_' reported erroneously as non-existent."); -} - -my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... -foreach (@check_servicetype) { - ($success, $msg, $existingURI) = $os->serviceExists(term => $_); - is($success, 1) - or diag("Service type '$_' reported erroneously as non-existent."); -} - -SKIP: { - skip "relationshipExists not implemented", 5 - unless MOBY::Client::OntologyServer->can("relationshipExists"); - - can_ok("MOBY::Client::OntologyServer", "relationshipExists") - or diag("OntologyServer should be able to tell whether a relationship exists"); - my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. - foreach (@check_rel) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. - foreach (@check_rel2) { - ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); - is($success, 1) - or diag("Relationship '$_' reported erroneously as non-existent."); - } - - my $invalid_rel = "HA"; - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); - ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); - is($success, 0) - or diag("Relationship '$invalid_rel' reported erroneously as existent."); -} - - -######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### -# -# Literal invalid names are OK here, since there's no obvious way to generate them -# and guarantee that they'll be invalid. -# -my $invalid_ns = "InvalidNS"; -($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); -is($success, 0) - or diag("Namespace '$invalid_ns' reported erroneously as existent."); - -my $invalid_obj = "InvalidObject"; -($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); -is($success, 0) - or diag("Object '$invalid_obj' reported erroneously as existent."); - -my $invalid_st = "InvalidServiceType"; -($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); -is($success, 0) - or diag("Service type '$invalid_st' reported erroneously as existent."); - +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 1.t' + +# Note added by Frank Gibbons. +# Tests should, as far as possible, avoid the use of literals. +# If you register a service with authURI => mysite.com, +# and you want to test a retrieved description of the service, +# don't test that the service returns authURI eq "mysite.com", +# test so that it returns the same value as you used to register it in the first place. + +######################### + +# change 'tests => 1' to 'tests => last_test_to_print'; +#use SOAP::Lite +trace; +use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details +use strict; +use MOBY::Client::OntologyServer; +use MOBY::Client::Central; +BEGIN { use_ok('MOBY::Client::OntologyServer'); + # initialize with a couple of useless things that we can guarantee to find + my $C = MOBY::Client::Central->new(); + + my %Namespace = ( namespaceType => 'Rub1', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + my $r = $C->registerNamespace( %Namespace ); + %Namespace = ( namespaceType => 'Rub2', + authURI => 'your.authority.URI', + description => "human readable description of namespace", + contactEmail => 'your at address.here' + ); + $r = $C->registerNamespace( %Namespace ); + my %ServiceType = ( serviceType => "Rub1", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + %ServiceType = ( serviceType => "Rub2", + description => "a human-readable description of the service", + contactEmail => 'your at email.address', + authURI => "test.suite.com", + Relationships => { ISA => ['Service'] } + ); + $r = $C->registerServiceType( %ServiceType ); + }; + + +END { + # Define cleanup of registry, to return it to its 'pristine' state, + # so that later attempts to run tests don't run into problems caused + # by failure of these tests, or abortion of the test script. + # Reconnect to MOBY Central here, since other connections + # will have gone out of scope by the time we get to this END block. + # Also can't use %Obj, + my $C = MOBY::Client::Central->new(); + my $r = $C->deregisterNamespace( namespaceType => 'Rub1' ); + $r = $C->deregisterNamespace( namespaceType => 'Rub2' ); + $r = $C->deregisterServiceType( serviceType => 'Rub1' ); + $r = $C->deregisterServiceType( serviceType => 'Rub2' ); + +}; + + +my @autoload = qw/host proxy/; +my @API = (@autoload, qw/new getUserAgent +objectExists serviceExists namespaceExists /); + +my $os = MOBY::Client::OntologyServer->new(); +diag "\n\nUsing Ontology Server at: ", $os->host, "\n\n"; +if (defined $ENV{TEST_VERBOSE} && $ENV{TEST_VERBOSE} == 1) { + print STDERR <host,"\n\n\n"; +} + +foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them. +can_ok("MOBY::Client::OntologyServer", @API) + or diag("OntologyServer doesn't implement full API"); + +# Check that accessor methods work correctly; +my ($old_host, $old_proxy) = ($os->host(), $os->proxy()); +my ($new_host, $new_proxy) = ("foo.cgi", "bar"); +is($os->host($new_host), $new_host) or diag("Couldn't set new host"); +is($os->host(), $new_host) or diag("Couldn't get host"); +is($os->host($old_host), $old_host) or diag("Couldn't return host to previous value"); + is($os->proxy($new_proxy), $new_proxy) or diag("Couldn't set proxy to new value"); + is($os->proxy(), $new_proxy) or diag("Couldn't get proxy"); +TODO: { + local $TODO = "How come I cant' set proxy back to its original value?"; + is($os->proxy($old_proxy), $old_proxy) or diag("Couldn't return proxy to previous value"); +} + +# Start fresh.... +$os = MOBY::Client::OntologyServer->new(); + +my ($success, $msg, $existingURI); +my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid +foreach (@check_ns) { + ($success, $msg, $existingURI) = $os->namespaceExists( term => $_); + is($success, 1) + or diag("Namespace '$_' reported erroneously as non-existent."); +} + +# Could get these allowed datatypes from MOBY::Config, +# except that module only works when you've got a local registry set up. +my @check_obj = qw/ Object String Integer Float DateTime/; # At least we can be confident that primitive types will always be valid +foreach (@check_obj) { + ($success, $msg, $existingURI) = $os->objectExists(term => $_); + is($success, 1) + or diag("Object '$_' reported erroneously as non-existent."); +} + +my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows.... +foreach (@check_servicetype) { + ($success, $msg, $existingURI) = $os->serviceExists(term => $_); + is($success, 1) + or diag("Service type '$_' reported erroneously as non-existent."); +} + +SKIP: { + skip "relationshipExists not implemented", 5 + unless MOBY::Client::OntologyServer->can("relationshipExists"); + + can_ok("MOBY::Client::OntologyServer", "relationshipExists") + or diag("OntologyServer should be able to tell whether a relationship exists"); + my @check_rel = qw/ISA HASA HAS/; # There should only be very few valid relationship types. + foreach (@check_rel) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'object'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + my @check_rel2 = qw/ISA/; # There should only be very few valid relationship types. + foreach (@check_rel2) { + ($success, $msg, $existingURI) = $os->relationshipExists(term => $_, ontology => 'service'); + is($success, 1) + or diag("Relationship '$_' reported erroneously as non-existent."); + } + + my $invalid_rel = "HA"; + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'service'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); + ($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel, ontology => 'object'); + is($success, 0) + or diag("Relationship '$invalid_rel' reported erroneously as existent."); +} + + +######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ############### +# +# Literal invalid names are OK here, since there's no obvious way to generate them +# and guarantee that they'll be invalid. +# +my $invalid_ns = "InvalidNS"; +($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns); +is($success, 0) + or diag("Namespace '$invalid_ns' reported erroneously as existent."); + +my $invalid_obj = "InvalidObject"; +($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj); +is($success, 0) + or diag("Object '$invalid_obj' reported erroneously as existent."); + +my $invalid_st = "InvalidServiceType"; +($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st); +is($success, 0) + or diag("Service type '$invalid_st' reported erroneously as existent."); + =================================================================== RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2007/02/05 21:17:47 1.56 +++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2007/11/26 23:16:23 1.57 @@ -75,6 +75,7 @@ # Can we connect to the registry? my $C = MOBY::Client::Central->new(); +diag "\n\nUsing Moby Central located at: ", $C->default_MOBY_server, "\n\n"; isa_ok( $C, 'MOBY::Client::Central',"Connected to test MOBY Central") or die("Cannot Connect to MOBY Central... cannot continue?"); From kawas at dev.open-bio.org Wed Nov 28 19:58:43 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 14:58:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711281958.lASJwhPk027970@dev.open-bio.org> kawas Wed Nov 28 14:58:42 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv27935/RDF/Ontologies/Cache Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache added to the repository moby-live/Perl/MOBY/RDF/Ontologies/Cache - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/RCS/directory,v: No such file or directory From kawas at dev.open-bio.org Wed Nov 28 19:58:46 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 14:58:46 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711281958.lASJwkJ6028024@dev.open-bio.org> kawas Wed Nov 28 14:58:46 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv27993/RDF/Ontologies/Cache Added Files: ServiceCache.pm CacheUtils.pm Log Message: moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,NONE,1.1 CacheUtils.pm,NONE,1.1 From kawas at dev.open-bio.org Wed Nov 28 20:01:23 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 15:01:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711282001.lASK1NoQ028102@dev.open-bio.org> kawas Wed Nov 28 15:01:23 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv28067/RDF/Ontologies Modified Files: Services.pm Log Message: added parameters to the constructor. also, when getting all services, modified behaviour to make multiple api calls rather than one findservice call. moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/26 22:49:03 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/28 20:01:23 1.6 @@ -19,6 +19,7 @@ use XML::LibXML; use MOBY::Client::Central; +use MOBY::Config; use MOBY::RDF::Predicates::DC_PROTEGE; use MOBY::RDF::Predicates::FETA; @@ -81,18 +82,26 @@ # new #----------------------------------------------------------------- sub new { - my ($class) = @_; + my ( $class, %args ) = @_; -#TODO - Extract the URIs for Namespaces/ServiceTypes/Objects/ServiceInstances from the moby config file -# create an object + # create an object my $self = bless {}, ref($class) || $class; - + # save some information retrieved from mobycentral.config - my $CONF = MOBY::Config->new; - $self->{uri} = $CONF->{mobycentral}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#'; + my $CONF = MOBY::Config->new; + $self->{uri} = $CONF->{mobycentral}->{resourceURL} + || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#' unless (defined $args{uri} and $args{uri}); + + # save the endpoint/namespace/uri if passed in + $self->{endpoint} = $args{endpoint} if $args{endpoint}; + $self->{namespace} = $args{endpoint} if $args{namespace}; + $self->{uri} = $args{uri} if $args{uri} and defined $args{uri}; + + # add a # at the end of the uri if it isnt there already $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; $self->{is_alive_path} = $CONF->{mobycentral}->{service_tester_path}; + # done return $self; } @@ -120,20 +129,32 @@ my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes'; my $services = []; my $RegObject; - - if ($name ne '' or $authURI ne '') { - my $moby = MOBY::Client::Central->new(); + + # use the passed in endpoint if applicable + my $moby = MOBY::Client::Central->new( + Registries => { + mobycentral => { + URL => $self->{endpoint}, + URI => 'http://mobycentral.cbr.nrc.ca/MOBY/Central' + } + } + ) + if $self->{endpoint}; + + # otherwise use default one + $moby = MOBY::Client::Central->new() unless $self->{endpoint}; + + if ( $name ne '' or $authURI ne '' ) { ( $services, $RegObject ) = - $moby->findService( authURI => $authURI, serviceName => $name ); - + $moby->findService( authURI => $authURI, serviceName => $name ); + } else { - my $moby = MOBY::Client::Central->new(); - my ( @URIS ) = $moby->retrieveServiceProviders(); - foreach my $provider (@URIS) { - my ( $instances, $RegObject ) = - $moby->findService( authURI => $provider ); - push @$services, @$instances; - } + my (@URIS) = $moby->retrieveServiceProviders(); + foreach my $provider (@URIS) { + my ( $instances, $RegObject ) = + $moby->findService( authURI => $provider ); + push @$services, @$instances; + } } my $xml = $self->_createRDFModel( \@$services ); @@ -160,26 +181,26 @@ my $storage = new RDF::Core::Storage::Memory; my $model = new RDF::Core::Model( Storage => $storage ); my $node_factory = new RDF::Core::NodeFactory(); - + foreach my $SI (@$services) { my $resource = new RDF::Core::Resource( $self->{uri}, - $SI->authority . "," . $SI->name ); + $SI->authority . "," . $SI->name ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->serviceDescription - ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->serviceDescription + ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->format ), - new RDF::Core::Literal( $SI->category ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->format ), + new RDF::Core::Literal( $SI->category ) + ) ); $model->addStmt( new RDF::Core::Statement( @@ -189,257 +210,260 @@ ) ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->locationURI ), - new RDF::Core::Literal( $SI->URL ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::FETA->hasServiceDescriptionText - ), - new RDF::Core::Literal( $SI->description ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::FETA->hasServiceDescriptionLocation - ), - new RDF::Core::Literal( $SI->signatureURL ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->locationURI ), + new RDF::Core::Literal( $SI->URL ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( + MOBY::RDF::Predicates::FETA->hasServiceDescriptionText + ), + new RDF::Core::Literal( $SI->description ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $resource, + $resource->new( + MOBY::RDF::Predicates::FETA->hasServiceDescriptionLocation + ), + new RDF::Core::Literal( $SI->signatureURL ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( - MOBY::RDF::Predicates::FETA->hasServiceNameText - ), - new RDF::Core::Literal( $SI->name ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( + MOBY::RDF::Predicates::FETA->hasServiceNameText + ), + new RDF::Core::Literal( $SI->name ) + ) ); # TODO get this value! - if ($self->{is_alive_path}) { + if ( -e $self->{is_alive_path} ) { my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($self->{is_alive_path} . '/isAliveStats.xml'); - my $value = "true"; - my $id = $SI->authority . "," . $SI->name; + my $doc = + $parser->parse_file( + $self->{is_alive_path} . '/isAliveStats.xml' ); + my $value = "true"; + my $id = $SI->authority . "," . $SI->name; my @nodelist = $doc->getElementsByTagName("service"); for my $node (@nodelist) { - next unless ($node->getAttribute( 'id' ) eq $id ); + next unless ( $node->getAttribute('id') eq $id ); $value = $node->textContent; last; } $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), - new RDF::Core::Literal($value) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), + new RDF::Core::Literal($value) + ) ); } else { + # by default, state the service is alive ... $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), - new RDF::Core::Literal('true') - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->isAlive ), + new RDF::Core::Literal('true') + ) ); } # add the authoring statements my $bnode = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->providedBy ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::FETA->authoritative ), - new RDF::Core::Literal( - $SI->authoritative == 0 ? "false" : "true" - ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), - new RDF::Core::Literal( $SI->contactEmail ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), - new RDF::Core::Literal( $SI->authority ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->organisation - ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->providedBy ), + $bnode + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::FETA->authoritative ), + new RDF::Core::Literal( + $SI->authoritative == 0 ? "false" : "true" + ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ), + new RDF::Core::Literal( $SI->contactEmail ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ), + new RDF::Core::Literal( $SI->authority ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->organisation + ) + ) ); # add parameter statements my $operation = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $resource, - $resource->new( MOBY::RDF::Predicates::FETA->hasOperation ), - $operation - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->hasOperationNameText - ), - new RDF::Core::Literal( $SI->name ) - ) + new RDF::Core::Statement( + $resource, + $resource->new( MOBY::RDF::Predicates::FETA->hasOperation ), + $operation + ) ); $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->operation ) - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->hasOperationNameText + ), + new RDF::Core::Literal( $SI->name ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $operation, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->operation ) + ) ); $bnode = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( MOBY::RDF::Predicates::FETA->performsTask ), - $bnode - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->operationTask + new RDF::Core::Statement( + $operation, + $resource->new( MOBY::RDF::Predicates::FETA->performsTask ), + $bnode ) - ) ); $model->addStmt( - new RDF::Core::Statement( - $bnode, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type - ) - ) + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->operationTask + ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $bnode, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + "http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type + ) + ) ); my $inputs = $SI->input; foreach (@$inputs) { my $inputParameter = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->inputParameter - ), - $inputParameter - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->inputParameter + ), + $inputParameter + ) ); if ( $_->isSimple ) { $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $_->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $_->objectType ) #TODO check for lsid ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->simpleParameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->simpleParameter + ) + ) ); my $namespaces = $_->namespaces; foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( @@ -452,67 +476,66 @@ ) ); } - } - elsif ( $_->isCollection ) { + } elsif ( $_->isCollection ) { $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) ); $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->collectionParameter + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->collectionParameter + ) ) - ) ); my $simples = $_->Simples; foreach my $simp (@$simples) { my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $simp->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $simp->objectType ) #TODO check for lsid ) ); @@ -520,31 +543,31 @@ foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( - MOBY::RDF::Predicates::RDF->type - ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA - ->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( + MOBY::RDF::Predicates::RDF->type + ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA + ->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( $inNamespaces, $resource->new( - MOBY::RDF::Predicates::RDF->type + MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" @@ -563,69 +586,69 @@ next unless $_->isSecondary; my $inputParameter = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->inputParameter - ), - $inputParameter - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->inputParameter + ), + $inputParameter + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->secondaryParameter - ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->secondaryParameter + ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->min ), - new RDF::Core::Literal( $_->min ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::FETA->min ), + new RDF::Core::Literal( $_->min ) + ) ) if defined( $_->min ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->max ), - new RDF::Core::Literal( $_->max ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::FETA->max ), + new RDF::Core::Literal( $_->max ) + ) ) if defined( $_->max ); @@ -640,30 +663,30 @@ ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasDefaultValue - ), - new RDF::Core::Literal( $_->default ) - ) + new RDF::Core::Statement( + $inputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasDefaultValue + ), + new RDF::Core::Literal( $_->default ) + ) ) if defined( $_->default ); $model->addStmt( - new RDF::Core::Statement( - $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->datatype ), - new RDF::Core::Literal( $_->datatype ) - ) - ); - foreach my $e ( @{ $_->enum } ) { - $model->addStmt( new RDF::Core::Statement( $inputParameter, - $resource->new( MOBY::RDF::Predicates::FETA->enum ), - new RDF::Core::Literal($e) + $resource->new( MOBY::RDF::Predicates::FETA->datatype ), + new RDF::Core::Literal( $_->datatype ) ) + ); + foreach my $e ( @{ $_->enum } ) { + $model->addStmt( + new RDF::Core::Statement( + $inputParameter, + $resource->new( MOBY::RDF::Predicates::FETA->enum ), + new RDF::Core::Literal($e) + ) ); } } @@ -672,94 +695,94 @@ foreach (@$outputs) { my $outputParameter = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $operation, - $resource->new( - MOBY::RDF::Predicates::FETA->outputParameter - ), - $outputParameter - ) + new RDF::Core::Statement( + $operation, + $resource->new( + MOBY::RDF::Predicates::FETA->outputParameter + ), + $outputParameter + ) ); if ( $_->isSimple ) { $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $outputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $_->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $_->objectType ) #TODO check for lsid ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->simpleParameter - ) - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->simpleParameter + ) + ) ); my $namespaces = $_->namespaces; foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( @@ -772,67 +795,66 @@ ) ); } - } - elsif ( $_->isCollection ) { + } elsif ( $_->isCollection ) { $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterNameText - ), - new RDF::Core::Literal( $_->articleName ) - ) - ); - $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->parameter - ) - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterNameText + ), + new RDF::Core::Literal( $_->articleName ) + ) + ); + $model->addStmt( + new RDF::Core::Statement( + $outputParameter, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->parameter + ) + ) ); my $pType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->hasParameterType - ), - $pType - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->hasParameterType + ), + $pType + ) ); $model->addStmt( - new RDF::Core::Statement( - $pType, - $resource->new( MOBY::RDF::Predicates::RDF->type ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA->collectionParameter + new RDF::Core::Statement( + $pType, + $resource->new( MOBY::RDF::Predicates::RDF->type ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA->collectionParameter + ) ) - ) ); my $simples = $_->Simples; foreach my $simp (@$simples) { my $oType = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->objectType - ), - $oType - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->objectType + ), + $oType + ) ); $model->addStmt( new RDF::Core::Statement( $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" - . $simp->objectType + "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + . $simp->objectType ) #TODO check for lsid ) ); @@ -840,31 +862,31 @@ foreach my $n (@$namespaces) { my $inNamespaces = $node_factory->newResource; $model->addStmt( - new RDF::Core::Statement( - $outputParameter, - $resource->new( - MOBY::RDF::Predicates::FETA->inNamespaces - ), - $inNamespaces - ) + new RDF::Core::Statement( + $outputParameter, + $resource->new( + MOBY::RDF::Predicates::FETA->inNamespaces + ), + $inNamespaces + ) ); $model->addStmt( - new RDF::Core::Statement( - $inNamespaces, - $resource->new( - MOBY::RDF::Predicates::RDF->type - ), - new RDF::Core::Resource( - MOBY::RDF::Predicates::FETA - ->parameterNamespace - ) - ) + new RDF::Core::Statement( + $inNamespaces, + $resource->new( + MOBY::RDF::Predicates::RDF->type + ), + new RDF::Core::Resource( + MOBY::RDF::Predicates::FETA + ->parameterNamespace + ) + ) ); $model->addStmt( new RDF::Core::Statement( $inNamespaces, $resource->new( - MOBY::RDF::Predicates::RDF->type + MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" @@ -877,11 +899,11 @@ } } } - my $xml = ''; + my $xml = ''; my $serializer = new RDF::Core::Model::Serializer( - Model => $model, - Output => \$xml, - BaseURI => 'URI://BASE/', + Model => $model, + Output => \$xml, + BaseURI => 'URI://BASE/', ); $serializer->serialize; return $xml; From mwilkinson at dev.open-bio.org Wed Nov 28 21:42:05 2007 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Wed, 28 Nov 2007 16:42:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711282142.lASLg5O8028702@dev.open-bio.org> mwilkinson Wed Nov 28 16:42:05 EST 2007 Update of /home/repository/moby/moby-live/Perl In directory dev.open-bio.org:/tmp/cvs-serv28683 Modified Files: MANIFEST Log Message: updated Manifest moby-live/Perl MANIFEST,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MANIFEST,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Perl/MANIFEST 2007/02/06 19:24:03 1.19 +++ /home/repository/moby/moby-live/Perl/MANIFEST 2007/11/28 21:42:05 1.20 @@ -1,34 +1,79 @@ -MANIFEST -README Changes +INSTALL +License Makefile.PL +MANIFEST This list of files +MOBY/Adaptor/moby/DataAccessI.pm +MOBY/Adaptor/moby/DataAdapterI.pm +MOBY/Adaptor/moby/Impl/FetaQueryAdaptor.pm +MOBY/Adaptor/moby/Impl/NamespaceDataAdapter.pm +MOBY/Adaptor/moby/Impl/ObjectDataAdapter.pm +MOBY/Adaptor/moby/Impl/ServiceInstanceDataAdapter.pm +MOBY/Adaptor/moby/Impl/ServiceTypeDataAdapter.pm +MOBY/Adaptor/moby/queryapi.pm +MOBY/Adaptor/moby/queryapi/mysql.pm +MOBY/Admin.pm +MOBY/Async.pm +MOBY/Async/LSAE.pm +MOBY/Async/Service.pm +MOBY/Async/SimpleServer.pm +MOBY/Async/WSRF.pm MOBY/authority.pm +MOBY/Central.pm MOBY/central_db_connection.pm -MOBY/OntologyServer.pm -MOBY/Config.pm -MOBY/dbConfig.pm +MOBY/Client/Central.pm +MOBY/Client/CollectionArticle.pm +MOBY/Client/Exception/MobyException.html +MOBY/Client/Exception/MobyException.pm +MOBY/Client/Exception/MobyExceptionCodes.html +MOBY/Client/Exception/MobyExceptionCodes.pm +MOBY/Client/OntologyServer.pm +MOBY/Client/Registration.pm +MOBY/Client/SecondaryArticle.pm +MOBY/Client/Service.pm +MOBY/Client/ServiceInstance.pm +MOBY/Client/SimpleArticle.pm +MOBY/Client/SimpleInput.pm +MOBY/collection_input.pm +MOBY/collection_output.pm MOBY/CommonSubs.pm +MOBY/Config.pm MOBY/CrossReference.pm +MOBY/dbConfig.pm +MOBY/lsid/authority/lsid_resolver.kpf +MOBY/lsid/authority/MobyMetadataResolver.pm +MOBY/MobyXMLConstants.pm +MOBY/MobyXMLRetriever.pl +MOBY/MOBYXSLT.pm +MOBY/myScript.pl +MOBY/mysql.pm +MOBY/OntologyServer.pm +MOBY/RDF/Ontologies/Cache/CacheUtils.pm +MOBY/RDF/Ontologies/Cache/ServiceCache.pm +MOBY/RDF/Ontologies/Namespaces.pm +MOBY/RDF/Ontologies/Objects.pm +MOBY/RDF/Ontologies/Services.pm +MOBY/RDF/Ontologies/ServiceTypes.pm +MOBY/RDF/Predicates/DC_PROTEGE.pm +MOBY/RDF/Predicates/FETA.pm +MOBY/RDF/Predicates/MOBY_PREDICATES.pm +MOBY/RDF/Predicates/OMG_LSID.pm +MOBY/RDF/Predicates/OWL.pm +MOBY/RDF/Predicates/RDF.pm +MOBY/RDF/Predicates/RDFS.pm +MOBY/RDF/Utils.pm +MOBY/secondary_input.pm MOBY/service_instance.pm MOBY/service_type.pm MOBY/simple_input.pm MOBY/simple_output.pm -MOBY/Central.pm -MOBY/Client/Central.pm -MOBY/Client/Registration.pm -MOBY/Client/ServiceInstance.pm -MOBY/Client/CollectionArticle.pm -MOBY/Client/OntologyServer.pm -MOBY/Client/SimpleArticle.pm -MOBY/Client/Service.pm -MOBY/Adaptor/moby/queryapi.pm -MOBY/Adaptor/moby/queryapi/mysql.pm MOBY/SOAP/Serializer.pm -MOBY/Async/LSAE.pm -MOBY/Async/Service.pm -MOBY/Async/SimpleServer.pm -MOBY/Async/WSRF.pm +MOBY/xsl/parseMobyMessage.xsl +README +scripts/AgentRDFValidator +scripts/authority.pl scripts/CloneCentralDatabases.pl +scripts/data.txt scripts/DebugYourService.pl scripts/FindServices.pl scripts/GetDump.pl @@ -36,8 +81,26 @@ scripts/GetResourceURLs.pl scripts/GetServicesProviders.pl scripts/GetServicesTypes.pl +scripts/MOBY-Admin.pl scripts/MOBY-Central.pl -scripts/Services.cgi +scripts/MOBY-Client05.cgi scripts/OntologyServer.cgi +scripts/RESOURCES +scripts/service_tester.pl +scripts/Services.cgi scripts/Services/HelloWorldService.pm scripts/Services/LocalServices.pm +scripts/ValidateService +t/Central.t +t/Client-Central.t +t/Client-CollectionArticle.t +t/Client-OntologyServer.t +t/Client-Registration.t +t/Client-SecondaryArticle.t +t/Client-Service.t +t/Client-ServiceInstance.t +t/Client-SimpleArticle.t +t/CommonSubs.t +t/Config.t +t/CrossReference.t +t/Template.t From kawas at dev.open-bio.org Wed Nov 28 23:33:22 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 28 Nov 2007 18:33:22 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711282333.lASNXMwV028839@dev.open-bio.org> kawas Wed Nov 28 18:33:22 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv28803/RDF Modified Files: Utils.pm Log Message: If libXSLT isnt installed, then the style sheet wont be apply, otherwise it is. moby-live/Perl/MOBY/RDF Utils.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/07/06 15:02:18 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/11/28 23:33:22 1.3 @@ -9,7 +9,6 @@ package MOBY::RDF::Utils; use XML::LibXML; -#use XML::LibXSLT; use strict; @@ -96,15 +95,24 @@ END } - my $parser = XML::LibXML->new(); -# my $xslt = XML::LibXSLT->new(); - my $source = $parser->parse_string($xml); -# my $style_doc = $parser->parse_string( $self->{xslt} ); -# my $stylesheet = $xslt->parse_stylesheet($style_doc); -# my $results = $stylesheet->transform($source); -# $xml = $stylesheet->output_string($results); - $xml = $source->toString(0); - return $xml; + + eval "require XML::LibXSLT"; + if ($@) { + my $parser = XML::LibXML->new(); + my $source = $parser->parse_string($xml); + $xml = $source->toString(0); + return $xml; + } else { + use XML::LibXSLT; + my $parser = XML::LibXML->new(); + my $xslt = XML::LibXSLT->new(); + my $source = $parser->parse_string($xml); + my $style_doc = $parser->parse_string( $self->{xslt} ); + my $stylesheet = $xslt->parse_stylesheet($style_doc); + my $results = $stylesheet->transform($source); + $xml = $stylesheet->output_string($results); + return "". $xml; + } } 1; From kawas at dev.open-bio.org Thu Nov 29 16:59:04 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 11:59:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291659.lATGx4xG030795@dev.open-bio.org> kawas Thu Nov 29 11:59:04 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv30748/Java/src/main/org/biomoby/shared/extended Modified Files: NamespaceParser.java ServiceInstanceParser.java DataTypeParser.java ServiceTypeParser.java Log Message: Changes include *takes into account URIs that don't have '#' in them, but have '/' *made code compliant with java1.5 so that warnings disappear moby-live/Java/src/main/org/biomoby/shared/extended NamespaceParser.java,1.7,1.8 ServiceInstanceParser.java,1.20,1.21 DataTypeParser.java,1.7,1.8 ServiceTypeParser.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2006/04/27 14:47:37 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2007/11/29 16:59:04 1.8 @@ -149,7 +149,7 @@ + this.url); // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -166,7 +166,9 @@ String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); - + else if(uri.lastIndexOf("/Namespaces/") > 0) { + name = uri.substring(uri.lastIndexOf("/Namepaces/")+"/Namespaces/".length()); + } MobyNamespace namespace = new MobyNamespace(name); if (resource.hasProperty(DC_PROTEGE.identifier)) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/12/07 16:37:36 1.20 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2007/11/29 16:59:04 1.21 @@ -8,7 +8,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import org.biomoby.client.rdf.vocabulary.DC_PROTEGE; @@ -151,7 +150,7 @@ + this.url); } // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -176,7 +175,7 @@ */ public MobyService[] getMobyServicesFromRDF(Model model) throws MobyException { // clear out any old information - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); if (model != null) { // lets start parsing this.parsedOkay = processModel(list, model); @@ -190,7 +189,7 @@ /** * @param list the list to put the services in @param model the model to use */ - private boolean processModel(ArrayList list, Model model) { + private boolean processModel(ArrayList list, Model model) { // clear out any old information this.parsedOkay = false; this.errors = new StringBuffer(); @@ -240,8 +239,10 @@ String[] parsedServiceType = serviceType.split("#"); if (parsedServiceType.length == 2) service.setType(parsedServiceType[1]); - else - service.setType(parsedServiceType[0]); + else if(serviceType.lastIndexOf("/Services/") > 0) { + service.setType(serviceType.substring(serviceType.lastIndexOf("/Services/")+"/Services/".length())); + } else + service.setType(parsedServiceType[0]); } } } @@ -307,8 +308,8 @@ Resource r = (Resource) s.getObject(); StmtIterator inputs = r.listProperties(FetaVocabulary.inputParameter); // collections to be added at the end the current scope - Map inputCollectionMap = new HashMap(); - Map outputCollectionMap = new HashMap(); + Map inputCollectionMap = new HashMap(); + Map outputCollectionMap = new HashMap(); // is the current service bad? while (inputs.hasNext()) { @@ -367,7 +368,9 @@ if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); - + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( FetaVocabulary.hasParameterNameText).getObject().toString(); @@ -381,7 +384,7 @@ continue; } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -395,6 +398,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns = ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -405,10 +411,8 @@ primaryInput.setDataType(new MobyDataType(datatype)); primaryInput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryInput.addNamespace(new MobyNamespace((String) nsIterator - .next())); + for (String ns : namespaces) { + primaryInput.addNamespace(new MobyNamespace(ns)); } } service.addInput(primaryInput); @@ -458,6 +462,9 @@ } if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( @@ -473,7 +480,7 @@ } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -487,6 +494,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns = ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -503,11 +513,9 @@ MobyPrimaryDataSimple input = new MobyPrimaryDataSimple(""); input.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { + for (String ns : namespaces) { input - .addNamespace(new MobyNamespace((String) nsIterator - .next())); + .addNamespace(new MobyNamespace(ns)); } } collection.addElement(input); @@ -684,7 +692,9 @@ .toString();*/ if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); - + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( FetaVocabulary.hasParameterNameText).getObject().toString(); @@ -695,7 +705,7 @@ // article name"); } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -709,6 +719,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns = ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -719,10 +732,8 @@ primaryOutput.setDataType(new MobyDataType(datatype)); primaryOutput.setName(articlename); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - primaryOutput.addNamespace(new MobyNamespace( - (String) nsIterator.next())); + for (String ns : namespaces) { + primaryOutput.addNamespace(new MobyNamespace(ns)); } } service.addOutput(primaryOutput); @@ -773,7 +784,9 @@ if (datatype.indexOf("#") > 0) datatype = datatype.substring(datatype.indexOf("#") + 1); - + else if(datatype.lastIndexOf("/Objects/") > 0) { + datatype = datatype.substring(datatype.lastIndexOf("/Objects/")+"/Objects/".length()); + } // extract the article name String articlename = parameter.getProperty( FetaVocabulary.hasParameterNameText).getObject().toString(); @@ -789,7 +802,7 @@ } // check for namespaces - ArrayList namespaces = new ArrayList(); + ArrayList namespaces = new ArrayList(); if (parameter.hasProperty(FetaVocabulary.inNamespaces)) { StmtIterator namespaceIterator = parameter.listProperties(FetaVocabulary.inNamespaces); while (namespaceIterator.hasNext()) { @@ -803,6 +816,9 @@ continue; if (ns.indexOf("#") > 0) ns = ns.substring(ns.indexOf("#") + 1); + else if(ns.lastIndexOf("/Namespaces/") > 0) { + ns= ns.substring(ns.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); + } namespaces.add(ns); } } @@ -819,10 +835,8 @@ MobyPrimaryDataSimple output = new MobyPrimaryDataSimple(""); output.setDataType(new MobyDataType(datatype)); if (!namespaces.isEmpty()) { - for (Iterator nsIterator = namespaces.iterator(); nsIterator - .hasNext();) { - output.addNamespace(new MobyNamespace((String) nsIterator - .next())); + for (String ns : namespaces) { + output.addNamespace(new MobyNamespace(ns)); } } collection.addElement(output); @@ -832,14 +846,11 @@ } // add the collections to the service - Iterator it = null; - for (it = inputCollectionMap.keySet().iterator(); it.hasNext();) { - service.addInput((MobyPrimaryDataSet) inputCollectionMap - .get((String) it.next())); + for (String key : inputCollectionMap.keySet()) { + service.addInput((MobyPrimaryDataSet) inputCollectionMap.get(key)); } - for (it = outputCollectionMap.keySet().iterator(); it.hasNext();) { - service.addOutput((MobyPrimaryDataSet) outputCollectionMap.get((String) it - .next())); + for (String key : outputCollectionMap.keySet()) { + service.addOutput((MobyPrimaryDataSet) outputCollectionMap.get(key)); } } if (!currentlyBad) @@ -859,7 +870,7 @@ public MobyService[] getMobyServicesFromRDF(String rdf) throws MobyException { // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -960,8 +971,9 @@ public static void main(String[] args) throws MobyException, MalformedURLException, IOException { // show how to use this class - ServiceInstanceParser p = new ServiceInstanceParser("http://localhost/ServiceInstance.rdf"); + ServiceInstanceParser p = new ServiceInstanceParser("http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances"); MobyService[] services = p.getMobyServicesFromRDF(); + System.out.println(services.length); if (!p.isRDFValid()) { System.out.println("One or more services in the RDF were invalid"); System.out.println("The errors are the following:"); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2007/07/17 18:11:42 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/DataTypeParser.java 2007/11/29 16:59:04 1.8 @@ -154,7 +154,7 @@ + this.url); // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -173,12 +173,17 @@ String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); - + else if(uri.lastIndexOf("/Objects/") > 0) { + name = uri.substring(uri.lastIndexOf("/Objects/")+"/Objects/".length()); + } String parent = null; if (resource.hasProperty(RDFS.subClassOf)) { parent = ((Resource)resource.getProperty(RDFS.subClassOf).getObject()).getURI(); if (parent.indexOf("#") > 0) parent = parent.substring(parent.indexOf("#")+1); + else if(parent.lastIndexOf("/Objects/") > 0) { + parent = parent.substring(parent.lastIndexOf("/Objects/")+"/Objects/".length()); + } } String description = resource.getProperty(RDFS.comment).getLiteral().getString(); // create the base datatype without container relationships =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2006/04/27 14:47:37 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceTypeParser.java 2007/11/29 16:59:04 1.9 @@ -147,7 +147,7 @@ + this.url); // lets start parsing - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // create the model Model model = ModelFactory.createDefaultModel(); RDFReader reader = model.getReader(); @@ -163,7 +163,9 @@ String name = ""; if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); - + else if(uri.lastIndexOf("/Services/") > 0) { + name = uri.substring(uri.lastIndexOf("/Services/")+"/Services/".length()); + } MobyServiceType servicetype = new MobyServiceType(name); if (resource.hasProperty(DC_PROTEGE.identifier)) { @@ -177,6 +179,9 @@ String parent = resource.getProperty(RDFS.subClassOf).getObject().toString(); if (parent.indexOf("#") > 0) parent = parent.substring(parent.indexOf("#")+1); + else if(parent.lastIndexOf("/Services/") > 0) { + parent = parent.substring(parent.lastIndexOf("/Services/")+"/Services/".length()); + } servicetype.setParentNames(new String[] {parent}); String description = resource.getProperty(RDFS.comment).getLiteral().getString(); servicetype.setDescription(description); From kawas at dev.open-bio.org Thu Nov 29 17:52:40 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 12:52:40 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291752.lATHqe7h031426@dev.open-bio.org> kawas Thu Nov 29 12:52:40 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31379/RDF/Ontologies Modified Files: Objects.pm Namespaces.pm Services.pm ServiceTypes.pm Log Message: *modified the db access code (connections are now created and destroyed as needed, rather than trying to maintain a single connection) *modified how URIs are obtained and used when creating RDF moby-live/Perl/MOBY/RDF/Ontologies Objects.pm,1.4,1.5 Namespaces.pm,1.3,1.4 Services.pm,1.6,1.7 ServiceTypes.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/07/19 18:26:59 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Objects.pm 2007/11/29 17:52:40 1.5 @@ -78,7 +78,6 @@ my $CONF = MOBY::Config->new; $self->{uri} = $CONF->{mobyobject}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Objects#'; $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; - $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyobject" )->dbh; $self->{uri_comp} = $self->{uri}; $self->{uri_comp} =~ s/\/MOBY\-S\//\/MOBY_SUB_COMPONENT\//; @@ -127,7 +126,7 @@ # add root of ontology $self->_addOntologyRoot($model); - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyobject" )->dbh; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -152,7 +151,6 @@ } $sth->finish(); $db->disconnect(); - my $xml = ''; my $serializer = new RDF::Core::Model::Serializer( Model => $model, @@ -198,7 +196,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyobject" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); @@ -443,9 +441,10 @@ my ( $self, $model, $term ) = @_; my $termExists = 0; - + + do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyobject" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/07/19 18:26:59 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Namespaces.pm 2007/11/29 17:52:40 1.4 @@ -76,7 +76,6 @@ my $CONF = MOBY::Config->new; $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; - $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobynamespace" )->dbh; $self->{query_all} = <{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobynamespace" )->dbh; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -306,7 +305,7 @@ my $node_factory = new RDF::Core::NodeFactory(); do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobynamespace" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/28 20:01:23 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/29 17:52:40 1.7 @@ -81,6 +81,18 @@ #----------------------------------------------------------------- # new #----------------------------------------------------------------- + +=head2 new + +Instantiate a Services object. + +Parameters: + * A Hash with keys: + -> endpoint => the BioMOBY registry endpoint to use + -> namespace => the BioMOBY registry namespace to use + +=cut + sub new { my ( $class, %args ) = @_; @@ -89,16 +101,64 @@ # save some information retrieved from mobycentral.config my $CONF = MOBY::Config->new; - $self->{uri} = $CONF->{mobycentral}->{resourceURL} - || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#' unless (defined $args{uri} and $args{uri}); + + # FIXME get me from api call + $self->{instance_uri} = $CONF->{mobycentral}->{resourceURL} || ''; + $self->{service_uri} = $CONF->{mobyservice}->{resourceURL} || ''; + $self->{datatype_uri} = $CONF->{mobyobject}->{resourceURL} || ''; + $self->{namespace_uri} = $CONF->{mobynamespace}->{resourceURL} || ''; # save the endpoint/namespace/uri if passed in $self->{endpoint} = $args{endpoint} if $args{endpoint}; $self->{namespace} = $args{endpoint} if $args{namespace}; - $self->{uri} = $args{uri} if $args{uri} and defined $args{uri}; - # add a # at the end of the uri if it isnt there already - $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; + unless ( $self->{instance_uri} ) { + my $moby = MOBY::Client::Central->new( + Registries => { + mobycentral => { + URL => $self->{endpoint}, + URI => 'http://mobycentral.cbr.nrc.ca/MOBY/Central' + } + } + ) + if $self->{endpoint}; + + # otherwise use default one + $moby = MOBY::Client::Central->new() unless $self->{endpoint}; + + # moby is a hash ref now + $moby = $moby->retrieveResourceURLs(); + + # add all uris + $self->{instance_uri} = $moby->{ServiceInstance}->[0] + if $moby->{ServiceInstance}->[0]; + $self->{service_uri} = $moby->{Services}->[0] if $moby->{Services}->[0]; + $self->{namespace_uri} = $moby->{Namespaces}->[0] + if $moby->{Namespaces}->[0]; + $self->{datatype_uri} = $moby->{Objects}->[0] if $moby->{Objects}->[0]; + + #revert to a default value if nothing is retrieved + $self->{instance_uri} = + 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#' + unless $moby->{ServiceInstance}->[0]; + $self->{service_uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Services#' + unless $moby->{Services}->[0]; + $self->{namespace_uri} = + 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#' + unless $moby->{Namespaces}->[0]; + $self->{datatype_uri} = 'http://biomoby.org/RESOURCES/MOBY-S/Objects#' + unless $moby->{Objects}->[0]; + } + + # add a / at the end of the uri if it isnt there already + $self->{instance_uri} = $self->{instance_uri} . "#" + unless $self->{instance_uri} =~ m/^.*(\#{1})$/; + $self->{service_uri} = $self->{service_uri} . "#" + unless $self->{service_uri} =~ m/^.*(\#{1})$/; + $self->{namespace_uri} = $self->{namespace_uri} . "#" + unless $self->{namespace_uri} =~ m/^.*(\#{1})$/; + $self->{datatype_uri} = $self->{datatype_uri} . "#" + unless $self->{datatype_uri} =~ m/^.*(\#{1})$/; $self->{is_alive_path} = $CONF->{mobycentral}->{service_tester_path}; @@ -184,7 +244,7 @@ foreach my $SI (@$services) { my $resource = - new RDF::Core::Resource( $self->{uri}, + new RDF::Core::Resource( $self->{instance_uri}, $SI->authority . "," . $SI->name ); $model->addStmt( new RDF::Core::Statement( @@ -367,7 +427,7 @@ $bnode, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type + $self->{service_uri} . $SI->type ) ) ); @@ -419,7 +479,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $_->objectType ) #TODO check for lsid ) @@ -470,7 +530,7 @@ $inNamespaces, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) @@ -534,7 +594,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $simp->objectType ) #TODO check for lsid ) @@ -570,7 +630,7 @@ MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) @@ -738,7 +798,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $_->objectType ) #TODO check for lsid ) @@ -789,7 +849,7 @@ $inNamespaces, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) @@ -853,7 +913,7 @@ $oType, $resource->new( MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( - "http://biomoby.org/RESOURCES/MOBY-S/Objects#" + $self->{datatype_uri} . $simp->objectType ) #TODO check for lsid ) @@ -889,7 +949,7 @@ MOBY::RDF::Predicates::RDF->type ), new RDF::Core::Resource( -"http://biomoby.org/RESOURCES/MOBY-S/Namespaces#" + $self->{namespace_uri} . $n ) #TODO check for lsids ) =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/07/19 18:26:59 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/ServiceTypes.pm 2007/11/29 17:52:40 1.3 @@ -77,7 +77,6 @@ my $CONF = MOBY::Config->new; $self->{uri} = $CONF->{mobyservice}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Services#'; $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; - $self->{moby_data_handler} = $CONF-> getDataAdaptor( source => "mobyservice" )->dbh; $self->{query_all} = <{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyservice" )->dbh; my $sth = $db->prepare( $self->{query_all} ); $sth->execute; @@ -313,7 +312,7 @@ # add the datatype Object to the model do { - my $db = $self->{moby_data_handler}; + my $db = MOBY::Config->new()-> getDataAdaptor( source => "mobyservice" )->dbh; my $sth = $db->prepare( $self->{query} ); $sth->execute( ($term) ); From kawas at dev.open-bio.org Thu Nov 29 17:53:34 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 12:53:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291753.lATHrYMR031520@dev.open-bio.org> kawas Thu Nov 29 12:53:34 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv31485/RDF/Ontologies/Cache Modified Files: CacheUtils.pm Log Message: slightly updated the doc for 'new' moby-live/Perl/MOBY/RDF/Ontologies/Cache CacheUtils.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/CacheUtils.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/CacheUtils.pm 2007/11/28 19:58:46 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/CacheUtils.pm 2007/11/29 17:53:34 1.2 @@ -80,9 +80,9 @@ Parameters: * A Hash with keys: - -> endpoint => the BioMOBY registry endpoint to use - -> namespace => the BioMOBY registry namespace to use - -> cache => the directory to store the cache + -> endpoint => the BioMOBY registry endpoint to use + -> namespace => the BioMOBY registry namespace to use + -> cache => the directory to store the cache If endpoint or cache are not specified, then new fails (dies). From kawas at dev.open-bio.org Thu Nov 29 17:54:58 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 12:54:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291754.lATHswOg031578@dev.open-bio.org> kawas Thu Nov 29 12:54:58 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv31543/RDF/Ontologies/Cache Modified Files: ServiceCache.pm Log Message: removed all instances where uri was passed in to the RDF generators moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/28 19:58:46 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 17:54:58 1.2 @@ -35,16 +35,17 @@ =head1 SYNOPSIS + # required my $cachedir = "/tmp/"; + + # optional - gets default values from MOBY::Client::Central my $url = "http://moby.ucalgary.ca/moby/MOBY-Central.pl"; my $uri = "http://moby.ucalgary.ca/MOBY/Central"; - my $service_uri = "http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#"; my $x = MOBY::RDF::Ontologies::Cache::ServiceCache->new( endpoint => $url, namespace => $uri, cache => $cachedir, - uri => $service_uri ); # create the service cache @@ -82,14 +83,9 @@ Parameters: * A Hash with keys: - -> endpoint => the BioMOBY registry endpoint to use - -> namespace => the BioMOBY registry namespace to use - -> cache => the directory to store the cache - -> uri => the service instance uri, - i.e. http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances# - This parameter is necessary if you are trying to generate - RDF for a non-default (neither your own local one or - the default mobycentral) registry! + -> endpoint => the BioMOBY registry endpoint to use + -> namespace => the BioMOBY registry namespace to use + -> cache => the directory to store the cache This subroutine attempts to create the cache directories right away and if any problems occur then an Exception is thrown. @@ -106,7 +102,7 @@ $self->{endpoint} = $args{endpoint} if $args{endpoint}; $self->{namespace} = $args{namespace} if $args{namespace}; $self->{cachedir} = $args{cache} if $args{cache}; - $self->{uri} = $args{uri} if $args{uri}; + eval { $self->{endpoint} = MOBY::Client::Central->new()->{default_MOBY_server}; @@ -167,7 +163,6 @@ $authorities_completed{$name} = 1; $xml = MOBY::RDF::Ontologies::Services->new( - uri => $self->{uri}, endpoint => $self->{utils}->_endpoint ); $xml = $xml->findService( { authURI => $name } ); my $file = File::Spec->catfile( @@ -315,8 +310,7 @@ foreach my $authURI ( keys %changed_services ) { $wasOld++; $xml = MOBY::RDF::Ontologies::Services->new( - endpoint => $self->{utils}->_endpoint, - uri => $self->{uri} ); + endpoint => $self->{utils}->_endpoint, ); $xml = $xml->findService( { authURI => $authURI } ); $file = File::Spec->catfile( From kawas at dev.open-bio.org Thu Nov 29 18:03:05 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 13:03:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291803.lATI354Z031661@dev.open-bio.org> kawas Thu Nov 29 13:03:05 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv31626/RDF/Ontologies/Cache Modified Files: ServiceCache.pm Log Message: removed a DEBUG print statement moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 17:54:58 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 18:03:05 1.3 @@ -351,7 +351,6 @@ sub get_rdf { my ($self) = @_; my $xml = ""; -print STDERR Dumper(\$self); my $lock = File::Spec->catfile( $self->{utils}->cachedir, $self->{utils}->_clean( $self->{utils}->_endpoint ), From kawas at dev.open-bio.org Thu Nov 29 18:09:31 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 13:09:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291809.lATI9Vdd031722@dev.open-bio.org> kawas Thu Nov 29 13:09:31 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF In directory dev.open-bio.org:/tmp/cvs-serv31687/RDF Modified Files: Utils.pm Log Message: removed the use LibXSLT because it wasnt needed moby-live/Perl/MOBY/RDF Utils.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/11/28 23:33:22 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Utils.pm 2007/11/29 18:09:31 1.4 @@ -103,7 +103,6 @@ $xml = $source->toString(0); return $xml; } else { - use XML::LibXSLT; my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); my $source = $parser->parse_string($xml); From kawas at dev.open-bio.org Thu Nov 29 19:45:55 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 14:45:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291945.lATJjtDf031922@dev.open-bio.org> kawas Thu Nov 29 14:45:54 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv31887/RDF/Ontologies Modified Files: Services.pm Log Message: added statement to ensure that is_alive_path is defined before using moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/29 17:52:40 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm 2007/11/29 19:45:54 1.8 @@ -305,7 +305,7 @@ ); # TODO get this value! - if ( -e $self->{is_alive_path} ) { + if ( $self->{is_alive_path} and -e $self->{is_alive_path} ) { my $parser = XML::LibXML->new(); my $doc = $parser->parse_file( From kawas at dev.open-bio.org Thu Nov 29 19:59:51 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 14:59:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711291959.lATJxpLS032040@dev.open-bio.org> kawas Thu Nov 29 14:59:51 EST 2007 Update of /home/repository/moby/moby-live/Perl/scripts In directory dev.open-bio.org:/tmp/cvs-serv32005/Perl/scripts Modified Files: RESOURCES Log Message: added service instance caching to the script moby-live/Perl/scripts RESOURCES,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/RESOURCES,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/scripts/RESOURCES 2007/08/14 23:28:36 1.1 +++ /home/repository/moby/moby-live/Perl/scripts/RESOURCES 2007/11/29 19:59:51 1.2 @@ -1,61 +1,105 @@ -#!/usr/bin/perl -w -#----------------------------------------------------------------- -# RESOURCES -# Author: Edward Kawas , -# For copyright and disclaimer see below. -# -# $Id$ -#----------------------------------------------------------------- - -# this is a 're-port' of the RESOURCES script from java back to perl - -use strict; -use CGI qw/:standard/; -use MOBY::RDF::Ontologies::Objects; -use MOBY::RDF::Ontologies::ServiceTypes; -use MOBY::RDF::Ontologies::Namespaces; -use MOBY::RDF::Ontologies::Services; - - -my $url = url(-relative=>1, -path_info=>1); - -my $form = new CGI; - -if ($url =~ m/^RESOURCES\/MOBY\-S\/Objects$/) { - - my $x = MOBY::RDF::Ontologies::Objects->new; - $x = $x->createAll(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/Services$/) { - my $x = MOBY::RDF::Ontologies::ServiceTypes->new; - $x = $x->createAll(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/ServiceInstances$/) { - my $x = MOBY::RDF::Ontologies::Services->new; - $x = $x->findService(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/Namespaces$/) { - my $x = MOBY::RDF::Ontologies::Namespaces->new; - $x = $x->createAll(); - print $form->header('text/xml'), $x if $x; - return; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/FULL$/) { - print $form->header('text/html'); - $form->start_html(-title=>'unavailable',); - print h2("not","implemented"); - print end_html; -} elsif ($url =~ m/^RESOURCES\/MOBY\-S\/ServiceDescription$/) { - print $form->header('text/html'); - $form->start_html(-title=>'unavailable',); - print h2("not","implemented"); - print end_html; -} else { - print $form->header('text/html'); - $form->start_html(-title=>'not MOBY-S',); - print h2("not","MOBY-S"); - print end_html; -} - +#!/usr/bin/perl -w +#----------------------------------------------------------------- +# RESOURCES +# Author: Edward Kawas , +# For copyright and disclaimer see below. +# +# $Id$ +# +# NOTES: +# 1. This script assumes that a BioMOBY registry is properly +# installed and that SetEnv commands have been added to +# the servers environment (e.g. httpd.conf) +# +# 2. Caching is enabled by default and can be toggled by +# modifying $useCache [0=> disbled, 1=> enabled] +# Caching really speeds up RDF generation and is highly +# recomended +# +# 3. Caching requires that a cache dir be specified and +# that the directory is readable by the web server +# process. By default, the cache dir is set to '/tmp/' +#----------------------------------------------------------------- + +# this is a 're-port' of the RESOURCES script from java back to perl + +use strict; +use CGI qw/:standard/; +use MOBY::RDF::Ontologies::Objects; +use MOBY::RDF::Ontologies::ServiceTypes; +use MOBY::RDF::Ontologies::Namespaces; +use MOBY::RDF::Ontologies::Services; +use MOBY::RDF::Ontologies::Cache::ServiceCache; + +# your cache dir +my $dir = "/tmp/"; + +# should we use caching? +my $useCache = 1; + +my $url = url( -relative => 1, -path_info => 1 ); + +my $form = new CGI; + +if ( $url =~ m/^RESOURCES\/MOBY\-S\/Objects$/ ) { + + my $x = MOBY::RDF::Ontologies::Objects->new; + $x = $x->createAll(); + print $form->header('text/xml'), $x if $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Services$/ ) { + my $x = MOBY::RDF::Ontologies::ServiceTypes->new; + $x = $x->createAll(); + print $form->header('text/xml'), $x if $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/ServiceInstances$/ ) { + my $x; + # shall we use the cache? + if ($useCache) { + $x = + MOBY::RDF::Ontologies::Cache::ServiceCache->new( cache => "$dir", ); + $x = $x->get_rdf(); + + } else { + # no cache + $x = MOBY::RDF::Ontologies::Services->new; + $x = $x->findService(); + + } + # output the RDF generated + print $form->header('text/xml'), $x if $x; + # say not implemented if an error occurs + do { + print $form->header('text/html'); + $form->start_html( -title => 'unavailable', ); + print h2( "not", "implemented" ); + print end_html; + } unless $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Namespaces$/ ) { + + my $x = MOBY::RDF::Ontologies::Namespaces->new; + $x = $x->createAll(); + print $form->header('text/xml'), $x if $x; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/FULL$/ ) { + + print $form->header('text/html'); + $form->start_html( -title => 'unavailable', ); + print h2( "not", "implemented" ); + print end_html; + +} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/ServiceDescription$/ ) { + print $form->header('text/html'); + $form->start_html( -title => 'unavailable', ); + print h2( "not", "implemented" ); + print end_html; + +} else { + + print $form->header('text/html'); + $form->start_html( -title => 'not MOBY-S', ); + print h2( "not", "MOBY-S" ); + print end_html; +} + From kawas at dev.open-bio.org Thu Nov 29 21:47:00 2007 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 Nov 2007 16:47:00 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711292147.lATLl0So032183@dev.open-bio.org> kawas Thu Nov 29 16:47:00 EST 2007 Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache In directory dev.open-bio.org:/tmp/cvs-serv32147/RDF/Ontologies/Cache Modified Files: ServiceCache.pm Log Message: added code that removes cached file segments when they no longer are deemed necessary moby-live/Perl/MOBY/RDF/Ontologies/Cache ServiceCache.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 18:03:05 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Cache/ServiceCache.pm 2007/11/29 21:47:00 1.4 @@ -377,7 +377,9 @@ # check if we need to re-merge the RDF my $isStale = $self->update_service_cache; if ( $isStale or !( -e $file ) ) { - + + my $providers = $self->_get_service_providers; + # re-merge rdf my $parser = XML::LibXML->new(); my $doc = undef; @@ -391,6 +393,8 @@ if $RDF eq $self->{utils}->RDF_FILE or $RDF eq $self->{utils}->LIST_FILE or $RDF eq $self->{utils}->UPDATE_FILE; + #remove those authorities that dont have any services + unlink(File::Spec->catfile( $dir, $RDF )) unless $providers->{$RDF}; do { eval { $doc = @@ -435,6 +439,37 @@ return $xml; } +sub _get_service_providers { + my ($self) = @_; + my $soap = + SOAP::Lite->uri( $self->{utils}->_namespace ) + ->proxy( $self->{utils}->_endpoint )->on_fault( + sub { + my $soap = shift; + my $res = shift; + die( "There was a problem calling the registry: " + . $self->{utils}->_endpoint . "\@ " + #. $self->{utils}->_namespace . ".\n" + . $res ); + } + ); + + my $xml = $soap->retrieveServiceNames()->result; + my %providers = (); + + my $parser = XML::LibXML->new(); + my $doc = $parser->parse_string($xml); + my $nodes = $doc->documentElement()->getChildrenByTagName('serviceName'); + for ( 1 .. $nodes->size() ) { + my $name = $nodes->get_node($_)->getAttribute('authURI'); + next if $providers{$name}; + $providers{$name} = 1; + } + + return \%providers; + +} + # creates the list file and returns it as a string sub _create_list_file { my ($self) = @_; From groscurt at dev.open-bio.org Fri Nov 30 08:49:10 2007 From: groscurt at dev.open-bio.org (Andreas Groscurth) Date: Fri, 30 Nov 2007 03:49:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711300849.lAU8nAY8000943@dev.open-bio.org> groscurt Fri Nov 30 03:49:09 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync In directory dev.open-bio.org:/tmp/cvs-serv907/src/main/org/biomoby/registry/sync Modified Files: CentralFactory.java Log Message: javadoc fix moby-live/Java/src/main/org/biomoby/registry/sync CentralFactory.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/CentralFactory.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/registry/sync/CentralFactory.java 2007/08/24 09:38:57 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/CentralFactory.java 2007/11/30 08:49:09 1.2 @@ -46,7 +46,6 @@ * @return the local central * @throws MobyException * whether the local central is not initialised - * @uml.property name="localCentral" */ public static CentralDigestImpl getLocalCentral() throws MobyException { if ( localCentral == null ) { @@ -61,7 +60,6 @@ * @return the master central * @throws MobyException * whether the master central is not initialised - * @uml.property name="masterCentral" */ public static CentralDigestImpl getMasterCentral() throws MobyException { if ( masterCentral == null ) { From groscurt at dev.open-bio.org Fri Nov 30 08:49:33 2007 From: groscurt at dev.open-bio.org (Andreas Groscurth) Date: Fri, 30 Nov 2007 03:49:33 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711300849.lAU8nX5d001002@dev.open-bio.org> groscurt Fri Nov 30 03:49:32 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler In directory dev.open-bio.org:/tmp/cvs-serv951/src/main/org/biomoby/registry/sync/handler Modified Files: ServiceTypeHandler.java DataTypeHandler.java AbstractMobyHandler.java ServiceHandler.java NamespaceHandler.java Log Message: javadoc fix moby-live/Java/src/main/org/biomoby/registry/sync/handler ServiceTypeHandler.java,1.1,1.2 DataTypeHandler.java,1.1,1.2 AbstractMobyHandler.java,1.1,1.2 ServiceHandler.java,1.1,1.2 NamespaceHandler.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceTypeHandler.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/registry/sync/handler/ServiceTypeHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceTypeHandler.java 2007/11/30 08:49:32 1.2 @@ -14,9 +14,6 @@ super(authority); } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyServiceType object ) { try { localCentral.registerServiceType( object ); @@ -29,9 +26,6 @@ return true; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyServiceType object ) { try { localCentral.unregisterServiceType( object ); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/DataTypeHandler.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/registry/sync/handler/DataTypeHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/DataTypeHandler.java 2007/11/30 08:49:32 1.2 @@ -13,9 +13,6 @@ super(authority); } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyDataType dataType ) { try { // try to register the full datatype @@ -29,9 +26,6 @@ return true; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyDataType dataType ) { try { // try to unregister the datatype =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/AbstractMobyHandler.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/registry/sync/handler/AbstractMobyHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/AbstractMobyHandler.java 2007/11/30 08:49:32 1.2 @@ -54,9 +54,6 @@ return centralLSID.compareToIgnoreCase( localLSID ) > 0; } - /** - * @see MobyHandler#change(T) - */ public boolean change( T object ) { if ( unregister( object ) ) { logger.fine( object.getLSID() + " was unregistered and will now be added to the local repository !" ); @@ -81,7 +78,7 @@ * * @param centralList * the entries of the master central - * @param localList + * @param local * the entries of the local central */ @SuppressWarnings( "unchecked" ) =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceHandler.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/registry/sync/handler/ServiceHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/ServiceHandler.java 2007/11/30 08:49:32 1.2 @@ -76,9 +76,6 @@ return false; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyService service ) { // the central admin class enables to delete a service @@ -100,9 +97,6 @@ return code == 200; } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyService service ) { // check whether the service shall be ignored due to the defined filter rules if ( ServiceFilter.getServiceFilter().isServiceFiltered( service ) ) { =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/NamespaceHandler.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/registry/sync/handler/NamespaceHandler.java 2007/08/24 09:42:01 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/sync/handler/NamespaceHandler.java 2007/11/30 08:49:32 1.2 @@ -13,9 +13,6 @@ super(authority); } - /** - * @see MobyHandler#register(T) - */ public boolean register( MobyNamespace namespace ) { try { // try to register the namespace at the local central @@ -28,9 +25,6 @@ return true; } - /** - * @see MobyHandler#unregister(T) - */ public boolean unregister( MobyNamespace namespace ) { try { // try to unregister the namespace From gordonp at dev.open-bio.org Fri Nov 30 17:23:17 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:23:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301723.lAUHNGwI002897@dev.open-bio.org> gordonp Fri Nov 30 12:23:16 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv2857/src/main/org/biomoby/client Modified Files: CentralCachedCallsImpl.java MobyRequest.java Log Message: Fixed missing passing of the registry to c-tors, which caused incorrect use of default registry for DOM-based object building moby-live/Java/src/main/org/biomoby/client CentralCachedCallsImpl.java,1.3,1.4 MobyRequest.java,1.27,1.28 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralCachedCallsImpl.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/client/CentralCachedCallsImpl.java 2007/06/08 20:30:22 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralCachedCallsImpl.java 2007/11/30 17:23:16 1.4 @@ -1,11 +1,3 @@ -/** - * Implements the functionality of caching by reusing identical calls to - * MOBY central (e.g. asking multiple times what services take a DNA - * sequence in the gi namespace). This is an in-memory cache in CentralImpl, - * but a filesystem cache backs it up here, so calls can be cached between - * JVM instances. - */ - package org.biomoby.client; import org.biomoby.registry.meta.RegistryCache; @@ -15,6 +7,15 @@ import java.io.*; import java.util.*; +/** + * Implements the functionality of caching by reusing identical calls to + * MOBY central (e.g. asking multiple times what services take a DNA + * sequence in the gi namespace). This is an in-memory cache in CentralImpl, + * but a filesystem cache backs it up here, so calls can be cached between + * JVM instances. This class is also thread-safe, and avoids redundant + * concurrent calls to the central registry. + */ + public class CentralCachedCallsImpl extends CentralImpl{ protected static String CHAR_ENCODING = "UTF-8"; protected static final String SYNTAX_TYPE = "xml"; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2007/06/16 00:26:01 1.27 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2007/11/30 17:23:16 1.28 @@ -529,6 +529,8 @@ mobyService.getName()), mobyXMLInputData); } catch(Exception e){ + e.printStackTrace(); + //System.err.println("Input: "+mobyInputXML); throw new SOAPException("While invoking SOAP Call: " + e); } From gordonp at dev.open-bio.org Fri Nov 30 17:23:17 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:23:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301723.lAUHNHWP002915@dev.open-bio.org> gordonp Fri Nov 30 12:23:16 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv2857/src/main/org/biomoby/shared Modified Files: MobyDataType.java Log Message: Fixed missing passing of the registry to c-tors, which caused incorrect use of default registry for DOM-based object building moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.20,1.21 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/01 14:27:10 1.20 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/30 17:23:16 1.21 @@ -141,6 +141,7 @@ datatypes = datatypesMapByURL.get(dataDefURL); if(datatypes == null){ System.err.println("Fetching data type ontology from " + dataDefURL); + (new Exception("Trace for "+className)).printStackTrace(); loadDataTypes(dataDefURL, reg); System.err.println(" ... done"); datatypes = datatypesMapByURL.get(dataDefURL); From gordonp at dev.open-bio.org Fri Nov 30 17:23:17 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:23:17 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301723.lAUHNHms002957@dev.open-bio.org> gordonp Fri Nov 30 12:23:16 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv2857/src/main/org/biomoby/shared/data Modified Files: MobyDataBoolean.java MobyDataComposite.java MobyDataDateTime.java MobyDataFloat.java MobyDataInt.java MobyDataObject.java MobyDataString.java Log Message: Fixed missing passing of the registry to c-tors, which caused incorrect use of default registry for DOM-based object building moby-live/Java/src/main/org/biomoby/shared/data MobyDataBoolean.java,1.5,1.6 MobyDataComposite.java,1.19,1.20 MobyDataDateTime.java,1.10,1.11 MobyDataFloat.java,1.8,1.9 MobyDataInt.java,1.7,1.8 MobyDataObject.java,1.20,1.21 MobyDataString.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBoolean.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/MobyDataBoolean.java 2007/06/09 18:14:33 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBoolean.java 2007/11/30 17:23:16 1.6 @@ -30,7 +30,7 @@ public MobyDataBoolean(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -43,7 +43,7 @@ /** Every c-tor eventually winds up here */ public MobyDataBoolean(String articleName, Boolean b, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYBOOLEAN, registry)); value = b; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/10/31 15:35:55 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2007/11/30 17:23:16 1.20 @@ -40,7 +40,7 @@ public MobyDataComposite(org.w3c.dom.Element element, Registry registry) throws MobyException{ this(MobyDataType.getDataType(element.getLocalName(), registry), getName(element), - getNamespace(element), + getNamespace(element, registry), getId(element)); if(getDataType() == null){ throw new MobyException("Attempted to build a composite MOBY object from XML, " + @@ -75,7 +75,7 @@ " does not have an article " + "name, which is required (tag "+element.getNodeName()+")"); } - MobyDataObject childObject = (MobyDataObject) createInstanceFromDOM(child); + MobyDataObject childObject = (MobyDataObject) createInstanceFromDOM(child, registry); if(childObject == null){ throw new MobyException("The object member '" + fieldName + "' for object '"+ getName() + " could not be properly parsed into a MOBY object"); @@ -86,7 +86,7 @@ } public MobyDataComposite(MobyDataType type, String name, MobyNamespace namespace, String id){ - super(namespace.getName(), id); + super(namespace.getName(), id, type.getRegistry()); setName(name); setDataType(type); members = new ConcurrentHashMap(); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java 2007/06/09 18:14:33 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java 2007/11/30 17:23:16 1.11 @@ -41,7 +41,7 @@ public MobyDataDateTime(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -53,7 +53,7 @@ } public MobyDataDateTime(String articleName, String stringISO8601, Registry registry) throws IllegalArgumentException{ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYDATETIME, registry)); value = parseISO8601(stringISO8601.trim()); } @@ -67,7 +67,7 @@ } public MobyDataDateTime(String articleName, GregorianCalendar cal, Registry registry){ - super(articleName, ""); + super(articleName, "", registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYDATETIME, registry)); value = cal; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java 2007/06/09 18:14:33 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java 2007/11/30 17:23:16 1.9 @@ -34,7 +34,7 @@ public MobyDataFloat(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -46,7 +46,7 @@ } public MobyDataFloat(String articleName, Number n, Registry r){ - super(articleName); + super(articleName, r); setDataType(MobyDataType.getDataType(MobyTags.MOBYFLOAT, r)); if(n instanceof BigDecimal){ value = (BigDecimal) n; @@ -100,7 +100,7 @@ } public MobyDataFloat(String articleName, String stringNumber, Registry registry) throws NumberFormatException{ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYFLOAT, registry)); value = new BigDecimal(stringNumber.trim()); } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java 2007/06/09 18:14:33 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java 2007/11/30 17:23:16 1.8 @@ -33,7 +33,7 @@ public MobyDataInt(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -46,7 +46,7 @@ } public MobyDataInt(String articleName, Number n, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry)); if(n instanceof BigInteger){ value = (BigInteger) n; @@ -76,7 +76,7 @@ } public MobyDataInt(String articleName, int i, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry)); value = new BigInteger(""+i); } @@ -95,7 +95,7 @@ } public MobyDataInt(String articleName, String stringNumber, Registry registry) throws NumberFormatException{ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry)); value = new BigInteger(stringNumber.trim()); } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/10/31 15:35:55 1.20 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2007/11/30 17:23:16 1.21 @@ -175,7 +175,7 @@ "instance to create"); } - return createInstanceFromDOM(elementChild); + return createInstanceFromDOM(elementChild, registry); } // There are six types of objects we can populate with data directly @@ -208,7 +208,7 @@ else{ MobyDataType type = MobyDataType.getDataType(objectClass, registry); // Treat base64-encoded binary data as a special case, as we have a convenience class for it - if(type != null && type.inheritsFrom(MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE))){ + if(type != null && type.inheritsFrom(MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE, registry))){ return new MobyDataBytes(objectTag, registry); } else{ @@ -238,11 +238,16 @@ } protected static MobyNamespace getNamespace(Element e){ + return getNamespace(e, null); + } + + protected static MobyNamespace getNamespace(Element e, Registry registry){ String namespace = MobyPrefixResolver.getAttr(e, "namespace"); - MobyNamespace nsObj = MobyNamespace.getNamespace(namespace); + MobyNamespace nsObj = MobyNamespace.getNamespace(namespace, registry); if(nsObj == null){ // Not in the ontology, so create a token namespace nsObj = new MobyNamespace(namespace == null ? "" : namespace); + nsObj.setRegistry(registry); } return nsObj; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/07/23 21:32:58 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java 2007/11/30 17:23:16 1.8 @@ -29,7 +29,7 @@ public MobyDataString(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{ this(getName(element), getTextContents(element), registry); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); } /** @@ -41,7 +41,7 @@ } public MobyDataString(String articleName, CharSequence stringValue, Registry registry){ - super(articleName); + super(articleName, registry); setDataType(MobyDataType.getDataType(MobyTags.MOBYSTRING, registry)); value = stringValue == null ? null : new StringBuffer(stringValue.toString()); } From gordonp at dev.open-bio.org Fri Nov 30 17:35:05 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:35:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301735.lAUHZ5ol003055@dev.open-bio.org> gordonp Fri Nov 30 12:35:05 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv3019/src/main/org/biomoby/shared Modified Files: MobyDataType.java Log Message: Removed verbosity moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.21,1.22 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/30 17:23:16 1.21 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java 2007/11/30 17:35:05 1.22 @@ -141,7 +141,6 @@ datatypes = datatypesMapByURL.get(dataDefURL); if(datatypes == null){ System.err.println("Fetching data type ontology from " + dataDefURL); - (new Exception("Trace for "+className)).printStackTrace(); loadDataTypes(dataDefURL, reg); System.err.println(" ... done"); datatypes = datatypesMapByURL.get(dataDefURL); From gordonp at dev.open-bio.org Fri Nov 30 17:42:15 2007 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 30 Nov 2007 12:42:15 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200711301742.lAUHgF6w003121@dev.open-bio.org> gordonp Fri Nov 30 12:42:15 EST 2007 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv3085/src/main/org/biomoby/shared/data Modified Files: MobyDataBytes.java Log Message: Fixed bug where registry wasn't being passed to namespace fetching in DOM-based c-tor moby-live/Java/src/main/org/biomoby/shared/data MobyDataBytes.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.java 2007/06/07 23:58:15 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBytes.java 2007/11/30 17:42:15 1.8 @@ -41,7 +41,7 @@ public MobyDataBytes(org.w3c.dom.Element element, Registry registry) throws MobyException{ super(MobyDataType.getDataType(BASE64_DATATYPE, registry), getName(element)); setId(getId(element)); - addNamespace(getNamespace(element)); + addNamespace(getNamespace(element, registry)); MobyDataType inputDataType = MobyDataType.getDataType(element.getLocalName(), registry); if(!inputDataType.inheritsFrom(MobyDataType.getDataType(BASE64_DATATYPE, registry))){