# Presentation: 684457

## Silver to Grid Data Services Session III: Deploying a Data Service on caGrid and using caGrid ServiceAPIs

- caBIGTM Annual Meeting
- June 23-25, 2008

## Overview of Sessions I - III

-  Divided into three 1 hour 15 minutes sessions

| Tuesday 
 | Wednesday
 |  |
| --- | --- | --- |
| 10:15 - 11:30 a.m. | 10:00 - 11:15 a.m. | Session I:  
Overview of the Silver to Grid training program.
Presentation and Live Demo of caGrid Semantic Interoperability. |
| 12:45  - 2:00 p.m. | 12:30 - 1:45 p.m | Session II (Lessons 1-5): 
Developing a Silver-Level Compatible Data Service API |
| 2:15 - 3:30 p.m.
 | 2:00 - 3:15 p.m
 | Session III (Lessons 6-9): 
Deploying a Data Service on caGrid and using caGrid Service APIs |

**Notes:**
This is an overview of the overview slide

What is covered in the 3 sessions today and tomorrow. 
Session 1: 
Overview of the Silver to Grid training program. (Whats in the full hands-on training program and the short versions we present today)
Presentation and Live Demo of caGrid Semantic Interoperability. (What you will be able to do on the grid if you complete the full training. You should have the knowledge, tools and code to do the demo yourself.)

Sessions 2-3 are a short course with key highlights from the full course, not full details or examples, no hands on exercises or demos. This might be enough for some to get started.

Session 2: 
Developing a Silver-Level Compatible Data Service API

Session 3: Deploying a Data Service on caGrid and using caGrid Service APIs

## Acknowledgements

- Peter McGarvey
- Baris Suzek
- Mike Keller
- Dianne Reeves
- George Komatsoulis
- Avinash Shanbhag
- Becky Angeles
- Jennifer Brush
- Jamie Parker
- Claire Wolfe
- Ken Smith
- Sal Mungal
- Virginia Hetrick
- Shannon Hastings
- Architecture/VCDE workspace participants

## Session III: Deploying a Data Service on caGrid and using caGrid Service APIs

**Notes:**
Session III we cover

caGrid Node Installation (prerequsite)
Data Service Deployment on caGrid
Using caGrid data service API
Using caGrid Metadata APIs

## Session III: Lessons

**Lesson 6: **Installing caGrid node for Data Service Deployment
**Lesson 7: **Deploying a caGrid Data Service
**Lesson 8: **Using caGrid Data Services
**Lesson 9: **Using caGrid Metadata Service APIs

**Notes:**
Session 3:
We will install a caGrid node, deploy a service, use this service and finally see how caGrid Metadata Service APIs

## Lesson 6:Installing caGrid for Data Service Deployment

## Installing caGrid for Data Service Deployment

## Outline

- Overview
- caGrid
- caGrid Infrastructure
- Step-by-step caGrid Installation for Data Service Deployment

## What is caGrid?

- Development project of Architecture Workspace
- Service oriented infrastructure that supports caBIGTM
- An architecture that allows building a grid of your own
- Enables collaborating institutions to share information and analytical resources efficiently and securely

## caGrid Community Involvement

- caGrid itself provides no real “data” or “analysis” to caBIGTM; its the enabling infrastructure which allows the community to develop
- Analytical Services
- Data Services
- Community members add value to the grid as applications, services (data/analytical), and processes
- caGrid provides the necessary core services, APIs, and tooling
- Community members develop end user applications/clients which consume the resources provided on the grid

## caGrid Infrastructure

**Client and service APIs are object oriented**, and operate over well-defined and **curated data types**
**Objects are defined in UML** and converted into ISO/IEC 11179 Administered Components, which are in turn registered in the **Cancer Data Standards Repository (caDSR)**
**Object definitions are drawn from controlled terminology **and the vocabulary is registered in the **Enterprise Vocabulary Services (EVS),** and their relationships are thus semantically described
**Objects** **are serialized to XML **that adhere to XML schemas registered in the **Global Model Exchange (GME)**

**Notes:**
Up here you see three of the core services.
Down hear you see the Grid Service 

## caGrid Infrastructure – cont’d

**Service and the hosting center metadata** is registered in **Index Service**

## caGrid Installation: Before starting  

- Dowload caGrid 1.2 Installer
- _[http://gforge.nci.nih.gov/frs/download.php/3738/caGrid-installer-1.2.zip](http://gforge.nci.nih.gov/frs/download.php/3738/caGrid-installer-1.2.zip)_
- Setting environment variables
- JAVA_HOME : Location of  Java JDK 1.5.X
- ANT_HOME: Location of Ant 1.6.5
- CATALINA_HOME: Location of Tomcat ver. 5.0.28
- GLOBUS_LOCATION: Location of Globus Toolkit ver. 4.0.3
- 	If not available, caGrid Installer installs Ant, Globus Toolkit and/or Tomcat
- Unzip caGrid-installer-1.2.zip
- Run caGrid installer:
**java -jar caGrid-installer-1.2.jar**

## caGrid Installation: Installation Types

- Choose any combination of installation types to install one or more caGrid components
- For data service deployment, choose options “Install caGrid” and “Configure Container”

## caGrid Installation: Service Container

- Choose Tomcat or Globus as service containers

## caGrid Installation: Prerequisites

- Install (or reinstall) prerequisite software

- Ant

- Tomcat

- Globus Toolkit

## caGrid Installation: Location

- Provide the directory where caGrid will be installed

## caGrid Installation: Target Grid 

- Each target grid basically uses different URLs for caGrid core services. For instance service URLs for OSU Training Grid are:
- cagrid.master.index.service.url=http://training03.cagrid.org:6080/wsrf/services/DefaultIndexService
- cagrid.master.cadsr.service.url=http://training02.cagrid.org:6080/wsrf/services/cagrid/CaDSRService
- cagrid.master.gme.service.url=http://training02.cagrid.org:6080/wsrf/services/cagrid/GlobalModelExchange
- cagrid.master.gridgrouper.service.url=https://training03.cagrid.org:6443/wsrf/services/cagrid/GridGrouper
- cagrid.master.dorian.service.url=https://dorian.cagrid.org:6443/wsrf/services/cagrid/Dorian

- Choose one of the available grids:
- NCICB Development
- NCICB Production
- NCICB QA
- OSU Development
- OSU Training
- and more

## caGrid Installation: Container Configuration

- Securing container is needed to host secure services.
- Secure services are those that require clients to use one of the Globus Security Infrastructure (GSI) authentication mechanisms.

## caGrid Installation: Completion

## Additional Information

- caGrid Wiki:
- _[http://www.cagrid.org/mwiki/index.php?title=CaGrid](http://www.cagrid.org/mwiki/index.php?title=CaGrid)_
- caBIGTM Architecture WS caGrid Web Page:
- _[https://cabig.nci.nih.gov/workspaces/Architecture/caGrid/](https://cabig.nci.nih.gov/workspaces/Architecture/caGrid/)_

## Lesson 7:Deploying a caGrid Data Service

## Deploying a caGrid Data Service

**Notes:**
Data Service Deployment on caGrid

## Outline

- Overview
- Major steps for deployment
- Introduce Toolkit
- Step-by-step deployment of a Data Service; gridPIR

## caGrid Data Service Deployment – Major steps

**Provide client and service APIs that are object oriented**
**Provide objects that are defined in UML** and registered in the Cancer Data Standards Repository (caDSR)
**Provide object definitions drawn from controlled terminology and vocabulary** registered in the Enterprise Vocabulary Services (EVS)
**Provide XML schemas that for XML serialization of objects **(may be registered in Global Model Exchange)
**Provide  service metadata about the center **where service is deployed

**Notes:**
Service deployment is actually:
collecting information on your service/model from different caGrid core services aggregating them 
registering them.

## caGrid Data Service Deployment – Major steps

**Register service metadata about the service and the center **where service is deployed

## Service Metadata (Domain Model Portion)

-  <ns135:**UMLAttribute** **dataTypeName**="CHARACTER" **description**="UniProtKB primary accession number." **name**="uniprotkbPrimaryAccession" **publicID**="2322254" **version**="1.0">
-      <ns135:SemanticMetadata **conceptCode**="C25402" **conceptDefinition**="A control number unique .....” **conceptName**="Accession Number" order="1"/>
- 	.....
-       <ns135:**ValueDomain longName**="Protein UniProtKB Primary Accession Number Genomic Identifier">
-       <ns135:**enumerationCollection**/>
-      </ns135:ValueDomain>
-  </ns135:UMLAttribute>

**Notes:**
Just to shed some light on what ServiceMetadata looks like

You don’t type in this information. Actually the information is already available/accesible from caGrid core services. So the deployment becomes to collect them/aggregate them/register tehm.

The aggregated information is stored as service metadata. Here is the domain model portion of the service data.
For an attribute it stores data type, CDE information, concept information and value domain information.

## Introduce: Grid Service Authoring Toolkit 

- An open-source and extensible toolkit
- Supports easy development and deployment of WS/WSRF compliant Grid services by hiding low level details of the Globus Toolkit
- Enables the implementation of strongly-typed Grid services
- Facilitates caGrid data service development using caCORE SDK artifacts through pluggable service styles

**Notes:**
The WS-Resource Framework (WSRF) is a set of six Web services specifications that define what is termed the WS-Resource approach to modeling and managing state in a Web services context. 

## Deploying a caGrid data service using Introduce: Grid-enablement of Protein Information Resource (gridPIR)

- A _data service_ to provide comprehensive and fully annotated protein related information for genomic and proteomic cancer research
- Developed using model driven approach and _caCORE SDK 3.2.1 _
- All data is public so _no security layer_ implemented

**Notes:**
Following screenshots may change with newer version of Introduce/caGrid but idea of deployment will remain the same.

## Introduce: Create a caGrid Service

**ant introduce **

- Modify an existing service

- Deploy an existing service

- Browse Data Types from caDSR or GME

## Introduce: Enter service information

**Introduce: Enter service information**

- An analytical service exposes operation(s) with input/output objects
- A data service exposes objects that presents the data resource

## Introduce: Data Service Configuration

**Introduce: Data Service Configuration**

- Different Service Styles (including caCORE SDK) supported.
- gridPIR is generated using caCORE SDK v3.2.1

- Optional extensions for Bulk Data Transfer or Web Services Enumeration

## Introduce: caCORE SDK-generated Client Selection  

**Two options for client selection:**
**Option 1:** **Use remote API** if data service caCORE-like system (API) and caGrid Data Service are on the _different_ machines
**Option 2:** **Use local API** if both caCORE-like system (API) and caGrid Data Service are deployed on _the same_ machine

## Introduce: Remote API Selection

**Library folder (including client jar) generated by caCORE SDK**

**Notes:**
Local API if the service and caCORE SDK generated API are on the same machine.

## Introduce: Remote API Selection

**Introduce: Remote API Selection**

**Treat all queries case-insensitive**

**Use Common Security Module**

**Enter URL for remote caCORE-like gridPIR API (publicly accessible)**

**Notes:**
CSM 
Authentication - Validating and verifying a user’s credentials to allow access to an application. 
Authorization - Granting access to data, methods, and objects. 

## Introduce: Choosing objects (model) service exposes

**Introduce: Choosing objects (model) service exposes**

**4. Add selected packages**

**1. Fetch models from caDSR**

**2. Select gridPIR model v1.2**

**3. Select package from gridPIR model **

**Notes:**
Fetching from caDSR is one of several options.

## Introduce: Choosing XML Schema 

**Find schemas from GME (if registered) **
**OR**
**Resolve schemas manually**

## Introduce: Choosing XML Schema – Manual Resolution (cont’d)

**Introduce: Choosing XML Schema – Manual Resolution (cont’d)**

**XSD generated by caCORE SDK**

## Introduce: Entering Service Description

**1. Select Metadata Tab**

**2. Select ServiceMetadata row**

**3. Edit Property**

## Introduce: Entering Service Metadata (cont’d)

- Enter:
-   POC
-   Hosting Center
-   Address

## Introduce: Deploy gridPIR Data Service

- Deploy an existing service

## Introduce: Selecting Data Service Location in the file system

- Compiled service stubs

- Metadata files

- Library files

- XML schemas

- Source code for service stubs

## Introduce: Selecting Data Service Location in the file system

**Container information**

**Register to Index Service?**

**URL for Index Service**

## Verifying Deployment

**URL for deployed service**

## Outcome

## Additional Information

- caGrid Wiki:
- _[http://www.cagrid.org/mwiki/index.php?title=CaGrid](http://www.cagrid.org/mwiki/index.php?title=CaGrid)_
- Introduce Toolkit Wiki:
- _[http://www.cagrid.org/mwiki/index.php?title=Introduce](http://www.cagrid.org/mwiki/index.php?title=Introduce)_
- caGrid Data Services Wiki:
- _[http://www.cagrid.org/mwiki/index.php?title=Data_Services](http://www.cagrid.org/mwiki/index.php?title=Data_Services)_
- caBIGTM Architecture WS caGrid Web Page:
- _[https://cabig.nci.nih.gov/workspaces/Architecture/caGrid/](https://cabig.nci.nih.gov/workspaces/Architecture/caGrid/)_

## Lesson 8:Using caGrid Data Services 

## Outline

- Overview
- CQL
- Using caGrid Portal
- Using Generic Data Service Client
- CQL Examples using gridPIR Data Service

## Executing a Data Service Query 

- Query

- Results

**Notes:**
For any data service user sends a CQL Query document to the data service. This invokes the exposed query method on service, translated to native query language such as SQL/HQL
Results are transformed/serialized into a CQL result file. User processes the results

## caBIG Query Language (CQL)

**CQL Query**: A simple wrapper element at the head of every CQL query document., contains the target.

**Target** : The Target element is of the type Object, and describes the data type which the query will return.

**Object**: Contains the required attribute ‘name.’ This attribute’s value defines the caDSR class of the object. When the Object is the top level target of a CQL query, it identifies the data type that will be returned by the caGrid Data Service. The Object allows for a choice between three child elements. The possible child elements are Attribute, Association, and Group. Objects may have at most one of these child elements. Groups also have an attribute ‘**logicOperator**,’ an enumeration of the values “**AND**” and “**OR**.”

- _[http://www.cagrid.org/mwiki/index.php?title=Data_Services:CQL](http://www.cagrid.org/mwiki/index.php?title=Data_Services:CQL)__ _

**Notes:**
Unfortunately the time is limited to capture all details of CQL but
There QBE idea of caCORE-like systems is still valid. You set a Target class, you set the criteria using attributes and associations. You can even use modifiers like “countOnly” 

## caGrid Portal

_**[http://cagrid-portal.nci.nih.gov/](http://cagrid-portal.nci.nih.gov/)**_

## caGrid Portal

**Discovery**

**Data Service Query**

**Portal Allows**
**Discovery **
**Exploration of:**
- Domain Models
- Semantic Metadata
- Hosting Center Info
**Data Queries**
**Example:**Query on Gene Objects

**Notes:**
Portal allows discovery and queries

Lets query GridPIR for some gene objects, first select the object gene

## caGrid Portal

**Notes:**
Animation on slide

## caGrid Portal

## caGrid Portal

- See Query and Results as XML

## Generic Data Service Client

**Can be used for caGrid data services that are based on caCORE-like systems since such services usually expose only the query method in its public API**
**For services that have additional methods other than query, specific clients generated by the Introduce Toolkit needs to be used**
**Typically query involves three steps**
- Initialization
- Creating and submitting a CQL query
- Processing the results

**Notes:**
A typical data service generated using SDK has two methods exposed; getServiceMetadata and query.

## Generic Data Service Client: Initializing the client

**For gridPIR Data Service:**
- String serviceURL= "**http://141.161.25.20:8080/wsrf/services/cagrid/GridPIR**";
- DataServiceClient client=new DataServiceClient(serviceURL);

## Generic Data Service Client: Creating a CQL query

**Option 1: Create CQLQuery object programmatically:**** **
**	**
**//**CQL query to retrieve all BRCA1 genes
**	**
- CQLQuery query = new CQLQuery();
- Object target = new Object();
- target.setName(**Gene**.class.getName());
- Attribute nameAttribute = new Attribute(“**name**", **Predicate.EQUAL_TO**, “**BRCA1**");
- target.setAttribute(nameAttribute);
- query.setTarget(target);

## Generic Data Service Client: Creating a CQL query

**Option 2: Load CQLQuery object from an XML string or file:**
**// from a string **
- CQLQuery query2 = (CQLQuery) Utils.deserializeObject( new StringReader(“
- <ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery">
-  <ns1:Target name="**edu.georgetown.pir.domain.Gene**">
-    <ns1:Attribute name="name" predicate="**EQUAL_TO**" value="**brca1**"/>
-  </ns1:Target>
- </ns1:CQLQuery>
- "), CQLQuery.class);
**// from a file **
- CQLQuery query3 = (CQLQuery) Utils.deserializeObject( new FileReader(cqlFile), CQLQuery.class);

## Generic Data Service Client: Submitting the CQL Query

**Results are returned as CQLQueryResults object:**
- 	try {
- 	**CQLQueryResults results = client.query(query);**
- } catch (QueryProcessingExceptionType ex) {
- 	// handle processing exception
- } catch (MalformedQueryExceptionType ex) {
- 	// handle malformed query
- } catch (RemoteException ex) {
- 	 // handle remote exception
- }

## Generic Data Service Client: Processing the results

**Option 1:** Results can be iterated as single items using a specialized implementation of the standard Java Iterator interface CQLQueryResultsIterator:
- Iterator iter = new **CQLQueryResultsIterator**(results,
**GridPIRClient.**class.getResourceAsStream("client-config.wsdd"));
- while (iter.hasNext()) {
- 	**Gene** gene = (Gene) iter.next();
- 	System.out.println(g.**getName**());
- }** **

## Generic Data Service Client: Processing the results

**Option 2: ** Results can be serialized to a string (or file for future processing) :
- StringWriter w = new StringWriter();
- Utils.**serializeObject**(
-  results,
-  new QName("http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLResultSet", "CQLResultSet“),
-  w);
- System.out.println(w.getBuffer());

## Find Protein objects for Human Breast cancer 1 (BRCA1):

<ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery">
 <ns1:Target name="edu.georgetown.pir.domain.Protein">
    <ns1:Group logicRelation="AND">
     <ns1:Association name="edu.georgetown.pir.domain.Gene"  roleName="geneCollection">
        <ns1:Attribute name="name" predicate="EQUAL_TO" value="brca1"/>
     </ns1:Association>
     <ns1:Association name="edu.georgetown.pir.domain.Organism“ roleName="organismCollection">
        <ns1:Attribute name="scientificName" predicate="EQUAL_TO" value="homo sapiens"/>
     </ns1:Association>
    </ns1:Group>
 </ns1:Target>
</ns1:CQLQuery>

- <ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery">
-  <ns1:Target name="**edu.georgetown.pir.domain.Protein**">
-     <ns1:Group logicRelation="**AND**">
-      <ns1:Association name="**edu.georgetown.pir.domain.Gene**"  roleName="**geneCollection**">
-         <ns1:Attribute name="**name**" predicate="**EQUAL_TO**" value="**brca1**"/>
-      </ns1:Association>
-      <ns1:Association name="**edu.georgetown.pir.domain.Organism**“ roleName="**organismCollection**">
-         <ns1:Attribute name="**scientificName**" predicate="**EQUAL_TO**" value="**homo sapiens**"/>
-      </ns1:Association>
-     </ns1:Group>
-  </ns1:Target>
- </ns1:CQLQuery>

**CQL Example: Query involving three classes**

## CQL Example: Query involving three classes

- Results**:**

## Additional Information	

**caGrid Data Services Wiki:**
**	**_**[http://www.cagrid.org/mwiki/index.php?title=Data_Services](http://www.cagrid.org/mwiki/index.php?title=Data_Services)**_
**caGrid Data Service Client API Wiki:**
**	**_**[http://www.cagrid.org/mwiki/index.php?title=Data_Services:Client_API](http://www.cagrid.org/mwiki/index.php?title=Data_Services:Client_API)**__** **_
**CQL Wiki:**
**	**_**[http://www.cagrid.org/mwiki/index.php?title=Data_Services:CQL](http://www.cagrid.org/mwiki/index.php?title=Data_Services:CQL)**__** **_

## Lesson 9: Using caGrid Metadata Service APIs 

## Outline

- Overview
- caGrid Metadata Service APIs
- caDSR Service API
- EVS Service API
- Discovery API
- MetadataUtils

## caGrid Data Service Metadata Overview - gridPIR

- UML Modeling

- Semantic Annotation using EVS concepts

- caDSR Load/CDE Creation

- EVS Concept Codes

- CDE Public ID/version

- UML Class/attribute

- CDE Long Name

**Notes:**
We have started with and information model in UML, annotated it using EVS concepts (note that each concept has a unique code), registered/loaded it to caDSR (transformed into caDSR metadata).

## Metadata Services on caGrid - caDSR

**Notes:**
Alll the metadata we registered or used are programmatically accessible via core service APIs 

## caDSR Grid Service API Client

**Provides access to information in the caDSR such as semantically annotated UML model as registered in caDSR**
**Has capability to generate caGrid standard metadata instances such as domain models **

## caDSR Grid Service API Client - Operations

**Provides access to the UML-like view of caDSR registered items:**
*findAllProjects*
*findPackagesInProject*
*findClassesInPackage*
*findAttributesInClass*
**Enables clients to generate caGrid standard Data Service metadata:**
*generateDomainModelForProject*
*generateDomainModelForPackage*
*generateDomainModelForClasse*s
*generateDomainModelForClassesWithExcludes*
**Provides clients the ability to augment a *****ServiceMetadata***** (standard caGrid service metadata) skeleton instance with the information extracted from caDSR**
*annotateServiceMetadata*

## caDSR Grid Service API Client – Retrieving list of projects from caDSR

**//caDSR service on production caGrid**
**String serviceURL=**_**[http://cagrid-service.nci.nih.gov:8080/wsrf/services/cagrid/CaDSRService](http://cagrid-service.nci.nih.gov:8080/wsrf/services/cagrid/CaDSRService)**_**;**
**// create a caDSRServiceClient instance**
**CaDSRServiceClient client = new CaDSRServiceClient(serviceURL);**
**// get list of projects from caDSR**
**Project[] projects = client.****findAllProjects()****;**
**//processing results**
**for (int i = 0; i < projects.length; i++) {**
**	****Project p = projects[i];**
**	****System.out.println(i+" Short name:"+p.****getShortName****()+" / Long name:"+p****.getLongName****());**

**Notes:**
As any other service API client needs an instance needs to be created

## caDSR Grid Service API Client – Retrieving list of projects from caDSR

**Result:**

## caDSR Grid Service API Client – Retrieving classes/attributes registered for a gridPIR from caDSR

**Result:**

## caDSR Grid Service API Client – Retrieving classes/attributes registered for a gridPIR  from caDSR

** ****// Retrieve the list of classes for a registered model **
**UMLClassMetadata[] classArray= client.**_**findClassesInProject(gridPIRProject)**_**;**
**        **
**// Retrieve the list of attributes for a class**
**UMLAttributeMetadata[] attributeArray= client.****findAttributesInClass(gridPIRProject,classArray[i]);**
**// Retrieve the value domain for an attribute**
**ValueDomain valueDomain=client.****findValueDomainForAttribute(gridPIRProject,attributeArray[j]);**
**        ****	****	****	****	****      ****	****	****	****	****	**

## Metadata Services on caGrid – Enterprise Vocabulary Services (EVS)

## EVS Grid Service API Client

**Provides information on vocabularies and terms/ concepts presented by the NCI Metathesaurus/ Thesaurus **

## EVS Grid Service API Client - Methods

**Provides a list of programmatically accessible vocabularies**
*getVocabularyNames*
**Provides access to concepts/terms from the vocabularies **
*searchDescLogicConcept*
**Provides complete *****History***** for concepts; the evolution of the concept as they are created, merged, modified, split, or retired. **
*getHistoryRecords*
**Provides access to concepts that are supported by the NCI Metathesaurus**
*searchMetaThesaurus*
*searchSourceByCode*

## EVS Grid Service API Client – Retrieve list of vocabularies provided by EVS

**//URL for production grid EVS Grid Service **
**String serviceURL="**_**[http://cagrid-service.nci.nih.gov:8080/wsrf/services/cagrid/EVSGridService](http://cagrid-service.nci.nih.gov:8080/wsrf/services/cagrid/EVSGridService)**_**";**
**// create a EVSServiceCLient instance**
**EVSGridServiceClient client=new EVSGridServiceClient(serviceURL);**
**//retrieve list of vocabularies service provides**
**DescLogicConceptVocabularyName****[] vocabularyNames=client.****getVocabularyNames()****;**
**//list the names of vocabularies**
**for(int i=0;i<vocabularyNames.length;i++){        ****	****	****	****	****System.out.println(i+": "+vocabularyNames[i].****getVocabularyName****());**
**}**

**Notes:**
As any other service API client needs an instance needs to be created

## EVS Grid Service API Client - Retrieve list of vocabularies provided by EVS

**Result:**

## EVS Grid Service API Client – Retrieve EVS concept code for a term

**//Set the search criteria **
**EVSDescLogicConceptSearchParams****  evsSearchParams = new EVSDescLogicConceptSearchParams();**
**	**
**	****//searching in NCI_Thesaurus**
**	****evsSearchParams.****setVocabularyName("NCI_Thesaurus");**
**	****//searching the concept code for term protein**
**     ****evsSearchParams.****setSearchTerm(“protein”);**
**	**
**	****//set maximum number of returned terms/concepts to 10   evsSearchParams.****setLimit(10);        ****	****	**
**	****//run query against the EVS grid service**
**	****DescLogicConcept****[] descLogicConcepts = client.****searchDescLogicConcept(evsSearchParams);**
**  ****	**
**	****//process results**

## EVS Grid Service API Client – Retrieve EVS concept code for a term

**Result:**

## Metadata Services on caGrid – Index Service

**Notes:**
We would like to discover services on the grid.  Who is providing the information I am looking for?

## Discovery API Client

**Provides methods to query the **_**Index Service**_** and used to discover services of interest**

**Notes:**
As any other service API client needs an instance needs to be created

## Discovery API Client - Methods

**Searches based on service level metadata**
*E.g. discoverServicesByResearchCenter *
**Searches based on semantic annotation**
*E.g. discoverDataServicesByModelConceptCode*
**Searches based on operation metadata (for analytical services)**
*E.g. discoverServicesByOperationName*
**Searches based on information model metadata (for data services)**
*E.g. discoverDataServicesByExposedClass*
**Searched based on XPath leveraging Service Metadata XML**
*discoverByFilter (String xpathPredicate)  *

**Notes:**
Give me all services hosted by Lombardi Comprehensive Cancer Center

Give me all services providing Gene information

Give who is exposing a certain class

## Discovery API Client – Discovering services using a keyword

**//Index service on production caGrid**
**String serviceURL="**_**[http://cagrid-index.nci.nih.gov:8080/wsrf/services/DefaultIndexService](http://cagrid-index.nci.nih.gov:8080/wsrf/services/DefaultIndexService)**_**";**
**// create a DiscoveryClient  instance**
**DiscoveryClient client = new DiscoveryClient(serviceURL);**
**//discover services by keyword**
**EndpointReferenceType[] endPointReferenceArr = client.****discoverServicesBySearchString(“Protein”)****;**
**//list URLs for returned services**
**for (int i=0; i < endPointReferenceArr.length; i++){**
**System.out.println("Address: "+****endPointReferenceArr[i].getAddress()****);**
**}**

**Notes:**
As any other service API client needs an instance needs to be created

## Discovery API Client – Discovering services using a keyword

**Result:**

## Metadata API - MetadataUtils

**Used to access and manipulate instances of service metadata **
**Complements the Discovery API;**
- Once a service is discovered MetadataUtils’s methods can be used to access and inspect the full metadata for the service

## Metadata API – MetadataUtils Methods

**Retrieves the service metadata or domain model from the specified service.**
*getServiceMetadata *
**Writes/reads the XML representation of the service metadata to/from the specified writer/reader:**
*serializeServiceMetadata*
*deserializeServiceMetadata *
**Writes/reads the XML representation of the domain model to/from the specified writer/reader:**
*serializeDomainModel *
*deserializeDomainModel*

**Notes:**
Domain model can be retrieved from caDSR as well. However Metautils helps accessing the really exposed model. Same model can be used by many services.

## Metadata API – MetadataUtils - Example

**//discover services by concept code used to annotate the model such as C17021 (Protein) **
**EndpointReferenceType[] endPointReferenceArr = client.****discoverServicesByModelConceptCode(“C17021”)****;**
**for (int i=0; i < endPointReferenceArr.length; i++){**
**	**** ****//retrieve service metadata for the service**
**ServiceMetadata**** serviceMetadata=****MetadataUtils.getServiceMetadata(endPointReferenceArr[i]);**
**//print host center information**
**System.out.println("Hosting Center: "+****serviceMetadata.getHostingResearchCenter().getResearchCenter().getDisplayName()****);**
**	**
**	****//retrieve domain model for the service**
**	****DomainModel**** domainModel=****MetadataUtils.getDomainModel(endPointReferenceArr[i]);**
**	**
**	****//print domain model name**
**	****System.out.println("Domain Model/Project Short Name: ****	****"+****domainModel.getProjectShortName());**
**	**
**	****System.out.println("Address: "+endPointReferenceArr[i].getAddress());**
**}**

## Metadata API – MetadataUtils - Example

**Result:**

## Additional Information	

- caGrid Wiki:
- _[http://](http://www.cagrid.org/mwiki/index.php?title=CaGrid)__[www.cagrid.org/mwiki/index.php?title](http://www.cagrid.org/mwiki/index.php?title=CaGrid)__[=](http://www.cagrid.org/mwiki/index.php?title=CaGrid)__[CaGrid](http://www.cagrid.org/mwiki/index.php?title=CaGrid)_
- caBIGTM Architecture WS caGrid Web Page:
- _[https://](https://cabig.nci.nih.gov/workspaces/Architecture/caGrid/)__[cabig.nci.nih.gov/workspaces/Architecture/caGrid](https://cabig.nci.nih.gov/workspaces/Architecture/caGrid/)__[/](https://cabig.nci.nih.gov/workspaces/Architecture/caGrid/)_

## Session III: Deploying a Data Service on caGrid and using caGrid Service APIs

**Notes:**
Session III we covered

caGrid Node Installation (prerequsite)
Data Service Deployment on caGrid
Using caGrid data service API
Using caGrid Metadata APIs

We also have seen the tools available to support these steps. 

## Questions

## Closing Remarks

**Notes:**
We have provided an overview of the steps for caCORE SDK centric caGrid data service development
caBIG provides enough tools to develop a data service from scratch pretty much without writing a single line of code.
Hope you have a better understanding of caBIG 
Have acquired the basics to start working on developing caGrid Data Services.
Have learned at least where and what to look for 

## Additional Resources 	

**caBIGTM web site: **_**[https://](https://cabig.nci.nih.gov/)**__**[cabig.nci.nih.gov](https://cabig.nci.nih.gov/)**__**[/](https://cabig.nci.nih.gov/)**_
**caBIGTM gForge site: **_**[https://](https://gforge.nci.nih.gov/)**__**[gforge.nci.nih.gov](https://gforge.nci.nih.gov/)**__**[/](https://gforge.nci.nih.gov/)**_** **
**caGrid Wiki: **_**[http://](http://www.cagrid.org/)**__**[www.cagrid.org](http://www.cagrid.org/)**__**[/](http://www.cagrid.org/)**_** **
**caBIGTM Learning Management System:**
**	**_**[http://ncicbtraining.nci.nih.gov/TP2005/tp2000web.dll/NCICBTraining](http://ncicbtraining.nci.nih.gov/TP2005/tp2000web.dll/NCICBTraining)**_**  **
**caCORE SDK: **_**[http://](http://ncicb.nci.nih.gov/infrastructure/cacoresdk)**__**[ncicb.nci.nih.gov/infrastructure/cacoresdk](http://ncicb.nci.nih.gov/infrastructure/cacoresdk)**_** **
**caBIGTM Compatibility Guidelines:**
**	**_**[https://](https://gforge.nci.nih.gov/docman/index.php?group_id=233&selected_doc_group_id=1138&language_id=1)**__**[gforge.nci.nih.gov/docman/index.php?group_id](https://gforge.nci.nih.gov/docman/index.php?group_id=233&selected_doc_group_id=1138&language_id=1)**__**[=233&selected_doc_group_id=1138&language_id=1](https://gforge.nci.nih.gov/docman/index.php?group_id=233&selected_doc_group_id=1138&language_id=1)**_** **
**Upcoming boot camps**
**	**