CaCORE

 view release on metacpan or  search on metacpan

lib/CaCORE/ApplicationService.pm  view on Meta::CPAN

	elsif ($pkgname eq "CaCORE::CaDSR::UMLProject" && $objname eq "UMLClassMetadata") {
		$newobj = new CaCORE::CaDSR::UMLProject::UMLClassMetadata;
	}
	elsif ($pkgname eq "CaCORE::CaDSR::UMLProject" && $objname eq "AttributeTypeMetadata") {
		$newobj = new CaCORE::CaDSR::UMLProject::AttributeTypeMetadata;
	}
	elsif ($pkgname eq "CaCORE::CaDSR::UMLProject" && $objname eq "UMLAttributeMetadata") {
		$newobj = new CaCORE::CaDSR::UMLProject::UMLAttributeMetadata;
	}
	elsif ($pkgname eq "CaCORE::CaDSR::UMLProject" && $objname eq "UMLAssociationMetadata") {
		$newobj = new CaCORE::CaDSR::UMLProject::UMLAssociationMetadata;
	}
	elsif ($pkgname eq "CaCORE::CaDSR::UMLProject" && $objname eq "SemanticMetadata") {
		$newobj = new CaCORE::CaDSR::UMLProject::SemanticMetadata;
	}
	elsif ($pkgname eq "CaCORE::CaDSR::UMLProject" && $objname eq "TypeEnumerationMetadata") {
		$newobj = new CaCORE::CaDSR::UMLProject::TypeEnumerationMetadata;
	}
	elsif ($pkgname eq "CaCORE::Common" && $objname eq "DatabaseCrossReference") {
		$newobj = new CaCORE::Common::DatabaseCrossReference;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "Source") {
		$newobj = new CaCORE::Common::Provenance::Source;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "PublicationSource") {
		$newobj = new CaCORE::Common::Provenance::PublicationSource;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "SourceReference") {
		$newobj = new CaCORE::Common::Provenance::SourceReference;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "WebServicesSourceReference") {
		$newobj = new CaCORE::Common::Provenance::WebServicesSourceReference;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "URLSourceReference") {
		$newobj = new CaCORE::Common::Provenance::URLSourceReference;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "InternetSource") {
		$newobj = new CaCORE::Common::Provenance::InternetSource;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "ResearchInstitutionSource") {
		$newobj = new CaCORE::Common::Provenance::ResearchInstitutionSource;
	}
	elsif ($pkgname eq "CaCORE::Common::Provenance" && $objname eq "Provenance") {
		$newobj = new CaCORE::Common::Provenance::Provenance;
	}
	## end DOMAIN OBJECT creator ##

	return $newobj;
}

1;

__END__

# Below is module documentation for ApplicationService

=pod

=head1 ApplicationService

CaCORE::ApplicationService is a utility class that encapsulates webservice invocation to caCORE server. ApplicationService object follows the Singleton pattern, in that each program will ONLY contain one instance of such class. The URL being passed t...

=head2 Synopsis

  my $appsvc = CaCORE::ApplicationService->instance(
  	"http://cabio.nci.nih.gov/cacore32/ws/caCOREService");
  my $gene = new CaCORE::CaBIO::Gene;
  $gene->setSymbol("NAT2");
  my @chromos = $appsvc->queryObject("CaCORE::CaBIO::Chromosome", $gene);

=head2 Operations

The following methods are supported in CaCORE::ApplicationService:

=over 1

=item *

C<instance(url)>: returns the ApplicationService instance. "url" is the service endpoint to a caCORE server. Example url: "http://cabio.nci.nih.gov/cacore30/ws/caCOREService".

=item *

C<queryObject(targetPath, sourceObject)>: invoke caCORE server to search for domain objects. This method returns at most 1000 objects because caCORE webservice automatically trims the result set to 1000 if actual result set is greater than 1000.

=item *

C<query(targetPath, sourceObject, startIndex, requestSize)>: invoke caCORE server to search for domain objects. Allows for specifying the return result set.

=back

Description of parameters used in the above functions:

=over 1

=item *

C<url>: the service endpoint to a caCORE server. Example url: "http://cabio.nci.nih.gov/cacore30/ws/caCOREService".

=item *

C<targetPath>: can be either a fully qualified target object name, such as "CaCORE::CaBIO::Gene"; or a series of comma separated fully qualified object names indicating a navigational path, such as "CaCORE::CaBIO::Taxon,CaCORE::CaBIO::Chromosome". Th...

=item *

C<sourceObject>: is the search criteria that specifies the search starting point.

=item *

C<startIndex> (for method "query" only): allows for control of the starting index of the result set. When presented, requestSize must also be present. 

=item *

C<requestSize> (for method "query" only): defines the requested size. Server trims the return result to the requested size before returns. If the result set is smaller than the requested size, the result set is returned without trimming. 

=back

=head2 Description

=head3 Search via ApplicationService->queryObject()

This following example retrieves all Chromosomes whose associated genes have a symbol of "NAT2" using the direct and basic search function of ApplicationService->queryObject(). This queryObject() function encapsulates the webservice invocation to the...

  use CaCORE::ApplicationService;
  use CaCORE::CaBIO;
  my $gene = new CaCORE::CaBIO::Gene;
  $gene->setSymbol("NAT2");
  my $appsvc = CaCORE::ApplicationService->instance(
  	"http://cabio.nci.nih.gov/cacore32/ws/caCOREService");
  my @chromos = $appsvc->queryObject("CaCORE::CaBIO::Chromosome", $gene);

=head3 Nested Search

The first parameter in the search method can be constructed as a "navigation path" that reflects how these objects are related to the target object. This example retrieves all the Taxons related to the Chromosomes that are related to a Gene object: 

  my @taxons = $appsvc->queryObject(
  	"CaCORE::CaBIO::Taxon,CaCORE::CaBIO::Chromosome", $gene);
  foreach my $tx (@taxons){
    print "id= " . $tx->getId . " scientificName=" . $tx->getScientificName ."\n";
  }

=head3 Result Set Control

Depending on the search criteria, a search may yield a large result set, which cause slower response time and increase the likelihood of failure. A throttle mechanism is provided by:

  ApplicationService->query(targetClassName, knownSourceObject, 
  		startingIndex, requestedSize)

In the following example:
  Parameter 1 indicates name of the target object, Gene, to be retrieved
  Parameter 2 indicates search criteria. In this case, is the chromosome associated with the genes.
  Parameter 3 indicates the requested start index, 10
  Parameter 4 indicates the requested size, 20

  my @geneSet = $appsvc->query("CaCORE::CaBIO::Gene", $chromo1, 10, 20);

This will retrieve related Gene objects from a Chromosome object, the result set starts from index number 10, and contains up to 20 Gene objects.



( run in 1.049 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )