Data Services are Deprecated in 6.4
Data services are currently deprecated in LexEVS 6.4 and will be remove in 6.5. Java based remote method invocation will remain available for the time being.
Introduction
This page describes remote web interfaces available through caCORE enabled LexEVS services and database models. It is important to note that all data services are removed for LexEVS 6.5. These services are replaced by a separate CTS2 compliant web service described in the CTS2 API. The focus of documentation will be the Java based LexEVS remote method invocation service.
Migration Notes
See migration notes below for LexEVS Distributed 6.0, 6.1 to 6.2, 6.3 to 6.4.1, 6.5
caCORE LexEVS Components
The caCORE LexEVS API was a public domain, open source web service that provides access to the LexEVS Terminology Service and Data Model. LexEVS supports the CBIIT hosted NCI Thesaurus, NCI Metathesaurus, and other vocabularies. In versions up to LexEVS 6.5 Java clients accessing vocabularies can communicate their requests via the open source caCORE data services but beyond that only java remote LexEVS APIs will be support
The open source interfaces provided in LexEVS versions up to LexEVS 6.4 include a Java API, a SOAP interface, QBE style data model query methods and an HTTP REST interface. These services are separate from the CTS2 REST API.
Interfaces
Main interfaces included in the LexEVSAPI package.
LexEVSService
Legacy caCORE Interface. Interface methods are deprecated after LexEVS 6.4. JavaDoc
LexEVSDistributed
The Distributed LexEVS Portion of LexEVSAPI. This interface is a framework for calling LexEVS API methods remotely, along with enforcing security measures. JavaDoc
LexEVS Distributed Migration Guide 6.0, 6.1, 6.2
LexEVSDataService
Removed in 6.5
See the CTS2 API for REST Services
The caCORE-SDK Data Service Portion of LexEVSAPI. This extends the caCORE ApplicationService to provide additional direct to database query options. JavaDoc
Search Paradigm
The caCORE LexEVS architecture includes a service layer that provides a single, common access paradigm to clients that use any of the provided interfaces. As an object-oriented middleware layer designed for flexible data access, caCORE LexEVS relies heavily on strongly typed objects and an object-in/object-out mechanism.
Accessing and using a caCORE LexEVS system requires the following steps:
- Ensure that the client application has access to the objects in the domain space.
- Formulate the query criteria using the domain objects.
- Establish a connection to the server.
- Submit the query objects and specify the desired class of objects to be returned.
- Use and manipulate the result set as desired.
caCORE LexEVS systems use four native application programming interfaces (APIs). Each interface uses the same paradigm to provide access to the caCORE LexEVS domain model, with minor changes specific to the syntax and structure of the clients. The following sections describe each API, identify installation and configuration requirements, and provide code examples.
The sequence diagram in Sequence diagram - caCORE 4.0 LexEVS API search mechanism illustrates the caCORE LexEVS API search mechanism implemented to access the NCI EVS vocabularies.
Querying the System
LexEVS conforms to the caCORE SDK API - for more information see caCORE SDK 4.1 Programmer's Guide.
QueryOptions
QueryOptions are designed to give the user extra control over the query before it is sent to the system. QueryOptions may be used to modify a query in these ways:
- 'CodingScheme' - Restricts the query to the specified Coding Scheme, instead of querying every available Coding Scheme.
CodingSchemeVersionOrTag' - Restricts the query to the specified Version of the Coding Scheme.
Note
This may NOT be specified without also specifying the 'CodingScheme' attribute.
If left unset, it will default to the version of the Coding Scheme tagged as "PRODUCTION" in the system.- 'SecurityTokens' - Security Tokens to use with the specified query. These Security Tokens are scoped to the current query ONLY. An subsequent queries will also need to specify the necessary Query Options.
'LazyLoad' - Some high use-case model Objects have bee 'lazy-load' enabled. This means that some attributes and associations of a model Object may not be fully populated when returned to the user. This allows for faster query times. This defaults to false, meaning that all attributes and associations will be eagerly fetched by the server and model Objects will always be fully populated. To enable this on applicable Objects, set to true.
Note
Lazy Loading may only be used in conjunction with specifying a Coding Scheme and Version with the 'CodingScheme' and 'CodingSchemeVersionOrTag' attributes above.
- 'ResultPageSize' - the page size of results to return. The higher the number, the more results the system will return to the user at once. The client will request the next group of query results transparenly. This parameter is useful for performance tuning. For example, if a query returns a result of10,000 Objects, a 'ResultPageSize' of '1000' would make 10 calls to the server returning a page of 1000 results each time. If left unset, this value will default to the default set Page Size
Examples of Use
The following query is a Query By Example with No Query Options.
Explanation of statements explains specific statements in the code by line number.
Line Number | Explanation |
---|---|
4 | Creates an instance of a class that implements the LexEVSApplicationService interface. This interface defines the service methods used to access data objects. |
7 | Construct the Query By Example Object and populate it with the desired search critieria. For this example, seach for any 'Entity' with an 'entityCode' attribute equaling 'C1234'. |
9 | Calls the search method of the LexEVSApplicationService object. |
The following example is a Query By Example with Query Options.
Explanation of statements explains specific statements in the code by line number.
Line Number | Explanation |
---|---|
4 | Creates an instance of a class that implements the LexEVSApplicationService interface. This interface defines the service methods used to access data objects. |
7 | Construct the QueryOptions Object. |
8 | Populate the QueryOptions with the desired Coding Scheme. |
9 | Construct a CodingSchemeVersionOrTag Object. |
10 | Populate the CodingSchemeVersionOrTag Object with the desired Version. |
11 | Populate the QueryOptions with the above CodingSchemeVersionOrTag Object. |
12 | Construct the Query By Example Object and populate it with the desired search critieria. For this example, seach for any 'Entity' with an 'entityCode' attribute equaling 'C1234'. |
14 | Calls the search method of the LexEVSApplicationService object, along with the QueryOptions. |
Removed in 6.5. See CTS2 API
The caCORE LexEVS Web Services API enables access to caCORE LexEVS data and vocabulary data from development environments where the Java API cannot be used, or where use of XML Web services is more desirable. This includes non-Java platforms and languages such as Perl, C/C++, .NET framework (C#, VB.Net), and Python.
The Web services interface can be used in any language-specific application that provides a mechanism for consuming XML Web services based on the Simple Object Access Protocol (SOAP). In those environments, connecting to caCORE LexEVS can be as simple as providing the end-point URL. Some platforms and languages require additional client-side code to handle the implementation of the SOAP envelope and the resolution of SOAP types.To view a list of packages that cater to different programming languages, visit http://www.w3.org/TR/SOAP/ and http://www.soapware.org/.
To maximize standards-based interoperability, the caCORE Web service conforms to the Web Services Interoperability Organization (WS-I) basic profile. The WS-I basic profile provides a set of non-proprietary specifications and implementation guidelines that enable interoperability between diverse systems. For more information about WS-I compliance, visit http://www.ws-i.org.
On the server side, Apache Axis is used to provide SOAP-based, inter-application communication. Axis provides the appropriate serialization and deserialization methods for the JavaBeans to achieve an application-independent interface. For more information about Axis, visit http://ws.apache.org/axis/.
Configuration
The caCORE/LexEVS WSDL file is located at http://lexevsapi60.nci.nih.gov/lexevsapi60/services/lexevsapi60Service?wsdl. In addition to describing the protocols, ports, and operations exposed by the caCORE LexEVS Web service, this file can be used by a number of IDEs and tools to generate stubs for caCORE LexEVS objects. This enables code on different platforms to instantiate native objects for use as parameters and return values for the Web service methods. For more information on how to use the WSDL file to generate class stubs, consult the specific documentation for your platform.
The caCORE LexEVS Web services interface has a single end point called lexevsapi60Service
, which is located at http://lexevsapi60.nci.nih.gov/lexevsapi60/services/lexevsapi60Service. Client applications should use this URL to invoke Web service methods.
Removed in 6.5. See CTS2 REST API
Building a Java SOAP Client
LexEVSAPI provides a tool to create a Java SOAP client capable of connecting to a LexEVSAPI SOAP service.
In the ./webServiceSoapClient contains a build.xml file that will construct a LexEVSAPI SOAP client. Before building, you may edit this build.xml file to customize the build process. Editable properties include 'wsdlURL' and 'webServiceNamespace'. An example configuration is below:
<property name="wsdlURL" value="http://server.localhost/lexevsapi60/services/lexevsapi60Service?wsdl"/> <property name="webServiceNamespace" value="http://server.localhost/lexevsapi60/services/lexevsapi60Service"/>
To build the client, use the command 'ant all' from the ./webServiceSoapClient directory.
Removed in 6.5. See CTS2 API
The caCORE LexEVS XML-HTTP API, based on the REST (Representational State Transfer) architectural style, provides a simple interface using the HTTP protocol. In addition to its ability to be invoked from most Internet browsers, developers can use this interface to build applications that do not require any programming overhead other than an HTTP client. This is particularly useful for developing Web applications using AJAX (Asynchronous JavaScript and XML).
Service Location and Syntax
The CORE EVS XML-HTTP interface uses the following URL syntax:
http://{server}/{servlet}?query={returnClass}&{criteria} &startIndex={index} &codingSchemeName={codingSchemeName} &codingSchemeVersion={codingSchemeVersion}
The following table explains the syntax, indicates whether specific elements are required, and gives examples.
Element | Meaning | Required | Example |
---|---|---|---|
| Name of the Web server on which the caCORE LexEVS 6.0 Web application is deployed. | Yes |
|
| URI and name of the servlet that will accept the HTTP GET requests. | Yes |
|
| Class name indicating the type of objects that this query should return. | Yes |
|
| Search request criteria describing the requested objects. | Yes |
|
| Starting index of the result set (Zero based). | No |
|
| Restrict the query to a specific Coding Scheme Name. | No | {{codingSchemeName=NCI_Thesaurus }} |
| Restrict the query to a specific Coding Scheme Version. | No Note Must be used in conjunction with a 'codingSchemeName' |
|
The caCORE LexEVS architecture currently provides two servlets that accept incoming requests:
- GetXML returns results in an XML format that can be parsed and consumed by most programming languages and many document authoring and management tools.
- GetHTML presents result using a simple HTML interface that can be viewed by most modern Internet browsers.
Within the request string of the URL, the criteria element specifies the search criteria using XQuery-like syntax. Within this syntax, square brackets ([ and ]) represent attributes and associated roles of a class, the at symbol (@) signals an attribute name/value pair, and a forward slash character /
specifies nested criteria.
Criteria statements in XML-HTTP queries generally use the following syntax (although you can also build more complex statements):
{ClassName}[@{attributeName}={value}] [@{attributeName}={value}]... ClassName}[@{attributeName}={value}]/ {ClassName}[@{attributeName}={value}]/...
The following table explains the syntax for criteria statements and gives examples.
Parameter | Meaning | Example |
---|---|---|
| The name of a class. |
|
| The name of an attribute of the return class or an associated class |
|
| The value of an attribute. |
|
Examples of Use
The examples in the following table demonstrate the usage of the XML-HTTP interface. In actual usage, these queries would either be submitted by a block of code or entered in the address bar of a Web browser.
Note
The servlet name GetHTML in the examples is used for placement into a browser address bar. It would be replaced with GetXML for use in an application.
Query | http://lexevsapi60.nci.nih.gov/lexevsapi60/GetHTML?query=Entity%5B@_entityCode=C1272*%5D |
---|---|
Semantic Meaning | Find all objects of type Entity that contain an 'entityCode' matching the pattern 'C123*'. |
Working with Result Sets
Because HTTP is a stateless protocol, the caCORE LexEVS server cannot detect the context of any incoming request. Consequently, each invocation of GetXML or GetHTML must contain all of the information necessary to retrieve the request, regardless of previous requests. Developers should consider this when working with the XML-HTTP interface.
Controlling the Start Index
To specify a specific start position in the result set, specify the &startIndex parameter. This will scroll to the desired position within the set of results.
Internal-Use Parameters
A number of parameters, such as &resultCounter, &pageSize, and &page, are used internally by the system and are not designed to be set by the user.
Note
When specifying attribute values in the query string, note that use of the following characters generates an error:
[ ] / \ # & %
Distributed LexEVS API
This is the only caCore API available in 6.5
Overview
This exposes the LexEVS Service model via a Remote Method Invocation service.
Architecture
The LexEVS API is exposed by the LexEVS caCORE System for remote access as shown in the figure below. The caCORE System's LexEVSApplicationService
class implements the LexBIGService
interface.
The distributed LexEVS API environment will be configured on the LexEVS Server currently at (http://lexevsapi6.nci.nih.gov/lexevsapi64).
LexEVS Annotations
To address LexEVS DAOs, the LexEVS API integration incorporates:
- Java annotation marking methods that can be safely executed on the client side
- classes that can be passed to the client without being wrapped by a proxy. The annotation is named
@lgClientSideSafe
. Every method in the LexEVS API that is accessible to the caCORE LexEVS user had to be considered and annotated if necessary. - Spring Aspect Oriented Programming (AOP) to proxy the LexEVS classes and intercept calls to their methods.
- The LexEVS client wraps every object returned by the LexBIGService inside an AOP Proxy with advice from a LexBIGMethodInterceptor ("the interceptor").
The following graphic shows a sequence diagram showing method interception. The interceptor is responsible for intercepting all client calls on the methods in each object. If a method is marked with the @lgClientSideSafe annotation, it proceeds normally. Otherwise, the object, method name, and parameters are sent to the caCORE LexEVS server for remote execution.
LexEVS Installation and Configuration
The distributed LexEVS API is strictly a Java interface and requires Internet access for remote connectivity to the caCORE LexEVS server.
Client configuration is represented in a client project in github: https://github.com/lexevs/LexEVS_Distributed_Client
The 6.4.0 version of the client features a mavenized project. Instructions for using the client in a maven project are found here
Example: Using the distributed LexEVS API
The following code sample shows how to retrieve all available coding schemes in the LexEVS repository.