The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 to the instance method is the service endpoint of the caCORE webservice. If no such URL is provided in the program, it will default to the caCORE production server, "http://cabio.nci.nih.gov/cacore30/ws/caCOREService". The ApplicationService class exposes two methods: queryObject and query for search. The ApplicationService is the fundamental class that all other search methods utilizes.

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);

Operations

The following methods are supported in CaCORE::ApplicationService:

  • 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".

  • 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.

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

Description of parameters used in the above functions:

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

  • 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". This navigational path specifies the relationship to traverse when retrieving the target objects.

  • sourceObject: is the search criteria that specifies the search starting point.

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

  • 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.

Description

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 caCORE server, and converts the returned XML into list of Chromosome objects. Parameter 1 indicates target class, Chromosome, to be retrieved. Parameter 2 indicates search criteria. In this case, is the gene associated with the chromosome.

  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);

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";
  }

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.

Limitations

By default, when calling ApplicationService->queryObject, the caCORE server automatically trim the resultset to 1000 objects if the there more than 1000. So in reality, if you want to retrieve anything beyond 1000, you must use ApplicationService->query.

SUPPORT

Please do not contact author directly. Send email to ncicb@pop.nci.nih.gov to request support or report a bug.

AUTHOR

Shan Jiang <jiangs@mail.nih.gov>

The CaCORE Software License, Version 1.0

Copyright 2001-2005 SAIC. This software was developed in conjunction with the National Cancer Institute, and so to the extent government employees are co-authors, any rights in such works shall be subject to Title 17 of the United States Code, section 105. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the disclaimer of Article 5, below. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the disclaimer of Article 5 in the documentation and/or other materials provided with the distribution.

  2. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by SAIC and the National Cancer Institute." If no such end-user documentation is to be included, this acknowledgment shall appear in the software itself, wherever such third-party acknowledgments normally appear.

  3. The names "The National Cancer Institute", "NCI" and "SAIC" must not be used to endorse or promote products derived from this software. This license does not authorize the licensee to use any trademarks owned by either NCI or SAIC.

  4. This license does not authorize or prohibit the incorporation of this software into any third party proprietary programs. Licensee is expressly made responsible for obtaining any permission required to incorporate this software into third party proprietary programs and for informing licensee's end-users of their obligation to secure any required permissions before incorporating this software into third party proprietary software programs.

  5. THIS SOFTWARE IS PROVIDED "AS IS," AND ANY EXPRESSED OR IMPLIED WARRANTIES, (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED. IN NO EVENT SHALL THE NATIONAL CANCER INSTITUTE, SAIC, OR THEIR AFFILIATES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.