Title: caCORE 3.0.1 API Presenters: Nafis Zebarjadi, SAIC - SDK Technical Trainer Michael Connolly, SAIC - caBIO Developer Jennifer Zeng, SAIC - caBIO Developer
1caCORE 3.0.1 APIPresenters Nafis Zebarjadi,
SAIC - SDK Technical Trainer Michael
Connolly, SAIC - caBIO Developer
Jennifer Zeng, SAIC - caBIO Developer
- Developer Boot Camp
- August 2005
- caCORE SDK Development Team
- SAIC
2Summary
- Learning Objectives
- Introduction
- API Demonstration
- Hands On Exercise
- Known Issues
- How to get help?
3Learning Objectives
- How to use caCORE 3.0.1 API Using
- caCORE Java API
- Domain Object Based Search Criteria
- Hibernate Detached Criteria
- Web Services API
4Introduction
- caCORE 3.0.1 API is
- Programmatic interface to caCORE hosted
vocabulary, metadata, and biomedical data - Output of caCORE SDK 1.0.3
5Introduction (cont.)
- caCORE 3.0.1 Provides
- Domain Objects
- ApplicationService class
- static getLocalInstance()
- static getRemoteInstance(String serverURL)
- search(Class targetObjectClass, Object
criteriaObject) - search(Class targetObjectClass, List
criteriaObjectList) - search(String path-to-targetObject, Object
criteriaObject) - search(String path-to-targetObject, List
criteriaObjectList) - query(Object criteria, String targetClassName)
- various print utility methods
6API Demonstration
- We will use code samples to demonstrate how to
apply each of these three query methods to
implement the following two use cases
7API Demonstration (cont.)
- Use Case 1 Search for GeneOntology based on a
Gene whose symbol is NAT2
8API Demonstration (cont.)
- Method 1
- ApplicationService appService
ApplicationService.getRemoteInstance("http//cabio
.nci.nih.gov/cacore30/server/HTTPServer") - Gene gene1 new GeneImpl()
- gene1.setSymbol("NAT2")
- List resultList1 appService.search(GeneOntology.
class, gene1)
9API Demonstration (cont.)
- Method 2
- ApplicationService appService
ApplicationService.getRemoteInstance(
"http//cabio.nci.nih.gov/cacore30/server/HTTPServ
er") - Gene gene1 new GeneImpl()
- gene1.setSymbol("NAT2")
- List resultList1 appService.search(Gene.class,
gene1) - for (Iterator resultsIterator
resultList1.iterator() resultsIterator.hasNext()
) - Gene returnedGene (Gene)resultsIterator.next()
- List geneOntologyList (List)returnedGene.getGene
OntologyCollection()
10API Demonstration (cont.)
- Use Case 2 Seach for the disease category of a
Disease which can be treated by an Agent with the
name Gleevec.
11API Demonstration (cont.)
- Method 1
- ApplicationService appService
ApplicationService.getRemoteInstance("http//cabio
.nci.nih.gov/cacore30/server/HTTPServer") - Agent agent2 new AgentImpl()
- agent2.setName("Gleevec")
- List resultList2 appService.search(
gov.nih.nci.cabio.domain.ProtocolAss
ociation, gov.nih.nci.cabio.domain.ClinicalTrialPr
otocol", agent2)
12API Demonstration (cont.)
- Method 2
- ApplicationService appService
ApplicationService.getRemoteInstance("http//cabio
.nci.nih.gov/cacore30/server/HTTPServer") - List agentList new ArrayList()
- Agent agent2 new AgentImpl()
- agent2.setName("Gleevec")
- agentList.add(agent2)
- ClinicalTrialProtocol ctp new
ClinicalTrialProtocolImpl() - ctp.setAgentCollection(agentList)
- List resultList2 appService.search(
ProtocolAssociation.class, ctp)
13API Demonstration (cont.)
- Hibernate Detached Criteria Scenario for Use Case
2 - DetachedCriteria dCriteria2 DetachedCriteria.for
Class(ProtocolAssociation.class) - dCriteria2.createAlias("clinicalTrialProtocol",
"clinical") - .createAlias("clinical.agentCollection", "agent")
- .add(Restrictions.ilike("agent.name",
"Gleevec")) - List resultList2 appService.query(dCriteria2,Pro
tocolAssociationImpl.class.getName())
14API Demonstration (cont.)
- Use Case 3 Get Description Logic Concepts from
the NCI Thesaurus for the term Organ. - ApplicationService appService ApplicationService.
getRemoteInstance( -
"http//cabio.nci.nih.gov/cacore30/serv
er/HTTPServer") - try
- String vocabularyName "NCI_Thesaurus"
- EVSQuery evsQuery new EVSQueryImpl()
- List evsResults new ArrayList()
- evsQuery.getDescLogicConcept("NCI_Thesaurus","O
rgan",false) - evsResults (List)appService.evsSearch(evsQuer
y) - appService.printEVSResults(evsResults)
- System.out.println("\n\n"evsResults.size()
" records found") - catch(Exception ex)
15API Demonstration (cont.)
- Steps to use caCORE 3.0.1 Web Services
- download WSDL file from http//cabio.nci.nih.gov/c
acore30/ws/caCOREService?wsdl - download axis1-2
- run wsdl2java program
- java org.apache.axis.wsdl.WSDL2Java cacore30.wsdl
- create a web service client (two variations)
- DII (Dynamic Invocation Interface) Client
- JAX-RPC Client
16API Demonstration (cont.)
- caCORE Web Service Expose 2 Methods
- queryObject(String pathToTarget, Object
criteriaObject) - query(String pathToTarget, Object criteriaObject,
int startRow, int resultSizeLimit)
17- Lets give it a try
- cd to C\wsClient
- run classpathenv.bat
- create domain objects and stubs
- run java org.apache.axis.wsdl.WSDL2Java
cacore30.wsdl - compiling and running web service test clients
- javac WSTestClientDII.java
- java WSTestClientDII
- javac WSTestClientRPC.java
- java WSTestClientRPC
18Hands On Exercise (1)
- Modify your existing caCORE3.0.1 Test Client to
do the following query - Question Find the Chromosome object(s) that
contain the Gene whose symbol is Gup1. - Model Relationship
19Hands On Exercise (1)
ApplicationService appService
ApplicationService.getRemoteInstance(
"http//cabio.nci.nih.gov/cacore30/server/HTTPSer
ver") Gene gene new GeneImpl() gene.setSymbol
("Gup1") List resultList3 appService.search("go
v.nih.nci.cabio.domain.Chromosome",
gene) if((resultList3 ! null)
(resultList3.size()lt1)) System.out.println(
"No records found") for (Iterator iterator
resultList3.iterator()iterator.hasNext())
Chromosome chrom (Chromosome)iterator.next()
System.out.println("Chromosome number "
chrom.getNumber())
20Hands On Exercise (2)
- Modify your existing caCORE3.0.1 Test Client to
do the following query - Question Search for a ProteinAlias based on
Chromosome number 8 going through Protein and
then Gene. - Model Relationship
21Hands On Exercise (2)
Chromosome chrom new ChromosomeImpl() chrom.set
Number("8") List resultList5
appService.search("gov.nih.nci.cabio.domain.Protei
nAlias," "gov.nih.nci.cabio.domain.Protei
n," "gov.nih.nci.cabio.domain.Gene",
chrom) if((resultList5 ! null)
(resultList5.size()lt1)) System.out.println(
"No records found") for (Iterator
iterator resultList5.iterator()iterator.hasNext
()) ProteinAlias proteinA
(ProteinAlias)iterator.next()
System.out.println("ProteinAlias name "
proteinA.getName())
22Hands On Exercise (3)
- Modify your existing caCORE3.0.1 Test Client to
do the following query - Question Search for Anomalies based on an Agent
name "FLAVOPIRIDOL" through the Target object. - Model Relationship
23Hands On Exercise (3)
- Our Nested Object Solution
Agent agent new AgentImpl() agent.setName("FLAV
OPIRIDOL") List agentList new
ArrayList() agentList.add(agent) Target target
new TargetImpl() target.setAgentCollection(agen
tList) List resultList7 appService.search("gov.
nih.nci.cabio.domain.Anomaly", target) if ((
resultList7 ! null)(resultList7.size() 0))
System.out.println("No Anomaly record
found.") for (Iterator iterator
resultList7.iterator()iterator.hasNext())
Anomaly anomaly (Anomaly)iterator.next()
System.out.println(" Anomaly
description " anomaly.getDescription())
24Hands on Exercise
- Our Path-to-Object Solution
Agent agent new AgentImpl() agent.setName("FLAV
OPIRIDOL") List resultList7 appService.search(
gov.nih.nci.cabio.domain.Anomaly,
gov.nih.nci.cabio.domain.Target", agent) if ((
resultList7 ! null)(resultList7.size() 0))
System.out.println("\nNo Anomaly record
found.") for (Iterator iterator
resultList7.iterator()iterator.hasNext())
Anomaly anomaly (Anomaly)iterator.next()
System.out.println(" Anomaly
description " anomaly.getDescription())
25Known Issues
- Range searching not supported.
- Data provenance package objects are empty.
- Must use get methods when retrieving objects
associated to Gene/Diseease/OrganOntology. - Consult release notes.
26How to get Help?
- NCICB Application Support
- http//ncicbsupport.nci.nih.gov/sw/
- Telephone 301-451-4384 or toll free
888-478-4423 - ncicb_at_pop.nih.gov
- Sign up for the caBIO Users Listserv when you
downlaod caCORE 3.0.1 - Open Development Initiative
- http//ncicb.nci.nih.gov/ODI
- NCICBOpenDevelopment_at_mail.nih.gov
27Further Reading
- caCORE SDK Programmers Guide
- ftp//ftp1.nci.nih.gov/pub/cacore/SDK/caCORE_SDK1.
0.3_Programmers_Guide.pdf - caCORE SDK Installation and Basic Test Guide
- ftp//ftp1.nci.nih.gov/pub/cacore/SDK/caCORE_SDK1.
0.3_Installation_and_Basic_Test_Guide.pdf - caCORE Technical Guide
- ftp//ftp1.nci.nih.gov/pub/cacore/caCORE2.0_Tech_G
uide.pdf - ftp//ftp1.nci.nih.gov/pub/cacore/caCORE3.0.1_Tech
_Supp.pdf - caCORE Web site
- http//ncicb.nci.nih.gov/core
28Questions?