Creating an ISO 21090 Data Service Using the caCORE SDK 4.3
| |
|
|
| |
Contents |
|
| |
|
|
| This tutorial uses caGrid 1.3 |
Overview
The purpose of this tutorial is to illustrate how to create a caGrid Data Service using Introduce backed by the caCORE SDK 4.3 using ISO21090 data types. This tutorial covers how to install the extension using the software update tool, how to use the extension to create a data service, and how to formulate and execute queries using the ISO 21090 data types.
Installation
| This extension relies on the ISO 21090 Introduce Types mapping extension for analytical services to provide the ISO 21090 data types schemas and serialization configuration. To install this extension, please perform steps 2 through 4 in the Overview section of the ISO 21090 analytical services tutorial. |
To utilize the extension, it must first be installed.
- Launch the Introduce toolkit
- From the Help menu, choose Introduce Software Update. Copy and paste the following into the "Update Site" field:
http://software.cagrid.org
- Click "Look For Updates" to locate the updates available at this site
- Check the box for "Data Services for caCORE SDK 4.3 with ISO21090 Datatypes (1.3.0.2)"


- Click "Next" twice to install the extension. Click the "Finish" button to restart Introduce.
Creating a Data Service
- Once introduce restarts, click "Create caGrid Service Skeleton". Fill in the information, being sure to select the Data Service radio button. Click "Create" to start building the service.


- When the service configuration dialog appears, choose "caCORE SDK 4.3" from the drop down.


- Click "OK" to start the service creation and configuration wizard
- On the first panel of the wizard, set the Application Name to "isoExample". Browse to the local-client directory generated by your caCORE SDK system (iso-example-project\target\dist\exploded\output\isoExample\package\local-client). Check the box for "Use JaxB Serialization"


- Click "Next: Security"
- Leave all the options here unchanged


- Click "Next: Domain Model"
- From the "Domain Model Source" drop down, select the "XMI" option
- Browse to the XMI file for your SDK system (iso-example-project\models\sdk.xmi), enter the Project Short Name "isoExample" and the Project Version "4.3"


- Click "Next: Schemas"
- Click "Automatically Map From SDK Generated Schemas"


- When all the "Status" column values change to "OK", click "Done" to complete the wizard
Introduce will build your grid data service using the information supplied. This process may take a few minutes to complete.
![]() |
Deploying the service
Once the service has been generated, you may close Introduce and deploy the data service to Tomcat.

cd <service dir>
ant deployTomcat -Dno.deployment.validation=true
Start the Tomcat container

cd $CATALINA_HOME
bin/startup.bat
Sample Queries
For the purpose of maintaining compatibility with existing CQL constructs, references to ISO data types are modeled and handled like associations between any other first-class data types. Restrictions on inner simple values of the ISO types are modeled like attributes.
String value queries
In the SDK's example data model, the UndergraduateStudent data type has a "name" attribute of the type String. A query against this model looks like this:
<ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery"> <ns1:Target name="gov.nih.nci.cacoresdk.domain.inheritance.multiplechild.UndergraduateStudent"> <ns1:Attribute name="name" predicate="LIKE" value="%student%"/> </ns1:Target> </ns1:CQLQuery>
For the ISO example model, the "name" attribute has been replaced with an ISO ST type. CQL treats this like an association from UndergraduateStudent to ST through the role name "name", and moves the attribute value restriction inside of the ST:
<ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery"> <ns1:Target name="gov.nih.nci.cacoresdk.domain.inheritance.multiplechild.UndergraduateStudent"> <ns1:Association name="gov.nih.nci.iso21090.St" roleName="name"> <ns1:Attribute name="value" predicate="LIKE" value="%student%"/> </ns1:Association> </ns1:Target> </ns1:CQLQuery>
The above query retrieves instances of the UngergraduateStudent type which have an St type associated through the role name "name". These St instances are required to have a "value" like "%student%".
Integer value queries
In the SDK's example model, the Computer type has an association to HardDrive, which has a size attribute of the type int. A query against this model might look like this:
<ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery"> <ns1:Target name="gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.Computer"> <ns1:Association name="gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.HardDrive" roleName="hardDriveCollection"> <ns1:Attribute name="size" predicate="EQUAL_TO" value="2"/> </ns1:Association> </ns1:Target> </ns1:CQLQuery>
Again, the ISO example model replaces the simple int attribute "size" with an Int association:
<ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery">
<ns1:Target name="gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.Computer">
<ns1:Association name="gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.HardDrive" roleName="hardDriveCollection">
<ns1:Association name="gov.nih.nci.iso21090.Int" roleName="size">
<ns1:Attribute name="value" predicate="EQUAL_TO" value="2"/>
</ns1:Association>
</ns1:Association>
</ns1:Target>
</ns1:CQLQuery>
In this case, the query retrieves Computer instances which have an associated HardDrive instance, which has an Int named "size" which has a value equal to "2".
Groups
The same concepts as above apply to groups of associations and attributes:
<ns1:CQLQuery xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery">
<ns1:Target name="gov.nih.nci.cacoresdk.domain.inheritance.onechild.Human">
<ns1:Group logicRelation="OR">
<ns1:Association name="gov.nih.nci.iso21090.St" roleName="hairColor">
<ns1:Attribute name="value" predicate="LIKE" value="%Color%"/>
</ns1:Association>
<ns1:Association name="gov.nih.nci.iso21090.St" roleName="diet">
<ns1:Attribute name="value" predicate="LIKE" value="%3"/>
</ns1:Association>
</ns1:Group>
</ns1:Target>
</ns1:CQLQuery>
The above query retrieves instances of Human which have St named "hairColor" whose value is like "%Color%" or have an St named "diet" whose value is like "%3".
Completed example
A completed example service following the above tutorial is available for download in zip format here.
This service contains a 'sampleQueries' directory which contains several CQL queries against the sample domain model which can be run.
The example service is built off the caCORE SDK 4.3 rc2 tag, and assumes the following database parameters:
DB_TYPE=mysql DB_SERVER=localhost DB_SERVER_PORT=3306 DB_NAME=sdk43_with_iso DB_USERNAME=root DB_PASSWORD=
Building and deploying the example service
The service must first be built and deployed before it can be used. Execute the following commands to build and deploy to Tomcat:

> ant all
> ant deployTomcat -Dno.deployment.validation
Once deployed, Tomcat must be started.

> cd $CATALINA_HOME
> bin/startup.sh
Invoking the example service.
The sample service can be invoked with a simple ant call:

> ant invokeQuery
This will invoke the service on the default URL (http://localhost:8080/wsrf/services/cagrid/IsoExampleService
) using a default query (sampleQueries/cdDataTypeCodeNotNull.xml). The results of the CQL query will be printed to the console as XML. Results should look something like this:

Buildfile: build.xml
setGlobus:
checkGlobus:
[echo] Globus: w:/Projects/dev-lib/ws-core-4.0.3defineClasspaths:
defineExtendedClasspaths:
invokeQuery:
[java] Executing query sampleQueries/cdDataTypeCodeNotNull.xml against http://localhost:8080/wsrf/services/cagrid/IsoExampleService
[java] 10:10:36,741 WARN [JavaUtils] Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[java] Querying
[java] Serializing results:
[java] <ns1:CQLQueryResults targetClassname="gov.nih.nci.cacoresdk.domain.other.datatype.CdDataType" xmlns:ns1="http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLResultSet">
[java] <ns1:ObjectResult>
[java] <ns2:CdDataType id="1" xmlns:ns2="gme://caCORE.caCORE/3.2/gov.nih.nci.cacoresdk.domain.other.datatype">
[java] <ns2:value1 xsi:type="ns3:CD" code="CODE1" xmlns:ns3="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns2:value2 xsi:type="ns4:CD" nullFlavor="NI" xmlns:ns4="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns2:value3 xsi:type="ns5:CD" nullFlavor="NI" xmlns:ns5="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns2:value4 xsi:type="ns6:CD" nullFlavor="NI" xmlns:ns6="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns2:value5 xsi:type="ns7:CD" nullFlavor="NI" xmlns:ns7="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns2:value6 xsi:type="ns8:CD" nullFlavor="NI" xmlns:ns8="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns2:value7 xsi:type="ns9:CD" nullFlavor="NI" xmlns:ns9="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns2:value8 xsi:type="ns10:CD" nullFlavor="NI" xmlns:ns10="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] </ns2:CdDataType>
[java] </ns1:ObjectResult>
[java] <ns1:ObjectResult>
[java] <ns11:CdDataType id="2" xmlns:ns11="gme://caCORE.caCORE/3.2/gov.nih.nci.cacoresdk.domain.other.datatype">
[java] <ns11:value1 xsi:type="ns12:CD" code="CODE2" xmlns:ns12="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns11:value2 xsi:type="ns13:CD" nullFlavor="NI" xmlns:ns13="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns11:value3 xsi:type="ns14:CD" nullFlavor="NI" xmlns:ns14="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns11:value4 xsi:type="ns15:CD" nullFlavor="NI" xmlns:ns15="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns11:value5 xsi:type="ns16:CD" nullFlavor="NI" xmlns:ns16="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns11:value6 xsi:type="ns17:CD" nullFlavor="NI" xmlns:ns17="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns11:value7 xsi:type="ns18:CD" nullFlavor="NI" xmlns:ns18="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns11:value8 xsi:type="ns19:CD" nullFlavor="NI" xmlns:ns19="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] </ns11:CdDataType>
[java] </ns1:ObjectResult>
[java] <ns1:ObjectResult>
[java] <ns20:CdDataType id="3" xmlns:ns20="gme://caCORE.caCORE/3.2/gov.nih.nci.cacoresdk.domain.other.datatype">
[java] <ns20:value1 xsi:type="ns21:CD" code="CODE3" xmlns:ns21="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns20:value2 xsi:type="ns22:CD" nullFlavor="NI" xmlns:ns22="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns20:value3 xsi:type="ns23:CD" nullFlavor="NI" xmlns:ns23="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns20:value4 xsi:type="ns24:CD" nullFlavor="NI" xmlns:ns24="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns20:value5 xsi:type="ns25:CD" nullFlavor="NI" xmlns:ns25="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns20:value6 xsi:type="ns26:CD" nullFlavor="NI" xmlns:ns26="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns20:value7 xsi:type="ns27:CD" nullFlavor="NI" xmlns:ns27="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns20:value8 xsi:type="ns28:CD" nullFlavor="NI" xmlns:ns28="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] </ns20:CdDataType>
[java] </ns1:ObjectResult>
[java] <ns1:ObjectResult>
[java] <ns29:CdDataType id="4" xmlns:ns29="gme://caCORE.caCORE/3.2/gov.nih.nci.cacoresdk.domain.other.datatype">
[java] <ns29:value1 xsi:type="ns30:CD" code="CODE4" xmlns:ns30="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns29:value2 xsi:type="ns31:CD" nullFlavor="NI" xmlns:ns31="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns29:value3 xsi:type="ns32:CD" nullFlavor="NI" xmlns:ns32="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns29:value4 xsi:type="ns33:CD" nullFlavor="NI" xmlns:ns33="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns29:value5 xsi:type="ns34:CD" nullFlavor="NI" xmlns:ns34="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns29:value6 xsi:type="ns35:CD" nullFlavor="NI" xmlns:ns35="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns29:value7 xsi:type="ns36:CD" nullFlavor="NI" xmlns:ns36="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns29:value8 xsi:type="ns37:CD" nullFlavor="NI" xmlns:ns37="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] </ns29:CdDataType>
[java] </ns1:ObjectResult>
[java] <ns1:ObjectResult>
[java] <ns38:CdDataType id="5" xmlns:ns38="gme://caCORE.caCORE/3.2/gov.nih.nci.cacoresdk.domain.other.datatype">
[java] <ns38:value1 xsi:type="ns39:CD" code="CODE5" xmlns:ns39="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns38:value2 xsi:type="ns40:CD" nullFlavor="NI" xmlns:ns40="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns38:value3 xsi:type="ns41:CD" nullFlavor="NI" xmlns:ns41="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns38:value4 xsi:type="ns42:CD" nullFlavor="NI" xmlns:ns42="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns38:value5 xsi:type="ns43:CD" nullFlavor="NI" xmlns:ns43="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns38:value6 xsi:type="ns44:CD" nullFlavor="NI" xmlns:ns44="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns38:value7 xsi:type="ns45:CD" nullFlavor="NI" xmlns:ns45="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] <ns38:value8 xsi:type="ns46:CD" nullFlavor="NI" xmlns:ns46="uri:iso.org:21090" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
[java] </ns38:CdDataType>
[java] </ns1:ObjectResult>
[java] </ns1:CQLQueryResults>
[java]
[java] DoneBUILD SUCCESSFUL
Total time: 3 seconds
To change the query file the client will execute, specify the property query.file when calling ant:

> ant invokeQuery -Dquery.file=sampleQueries/dsetCdEdText.xml
Additionally, the service URL may be specified with the service.url property:

> ant invokeQuery -Dservice.url=http://host:port/path







