NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Example environment technology includes Java 1.78, Maven 3.2.3, Git, and Eclipse Neon or some other maven enabled Eclipse IDE. 
  2. This example assumes some familiarity with Eclipse and Maven.
  3. Run git clone https://github.com/lexevs/LexEVS_Distributed_Client.git
  4. Change working directory to LexEVS_Distributed_Client
  5. Run

    Code Block
    languagebash
    mvn clean install

    , if tests fail you may add -DskipTests

  6. Create a new Java Project in Eclipse
  7. Configure as a Maven project
  8. Add as dependency to the pom file:

...

Code Block
languagejava
themeEclipse
package org.lexgrid.lexevs.remote.client;

import org.LexGrid.LexBIG.DataModel.Collections.CodingSchemeRenderingList;
import org.LexGrid.LexBIG.DataModel.InterfaceElements.CodingSchemeRendering;
import org.LexGrid.LexBIG.Exceptions.LBInvocationException;
import org.LexGrid.LexBIG.caCore.interfaces.LexEVSDistributed;

import gov.nih.nci.system.client.ApplicationServiceProvider;

public class MavenBasedPrototype {

	LexEVSDistributed lbs = null;
	private static String serviceUrl = "https://localhost.daplie.com:8443/lexevsapi64lexevsapi65";
	public void run() throws LBInvocationException{
		try {
			lbs = (LexEVSDistributed)ApplicationServiceProvider.getApplicationServiceFromUrl(serviceUrl, "EvsServiceInfo");
	}
		catch(Exception e){
			System.out.println("Starting LexEVS Remote Client fails" + e);
	}

	CodingSchemeRenderingList list = lbs.getSupportedCodingSchemes();
		for(CodingSchemeRendering rendering: list.getCodingSchemeRendering()){
			System.out.println(rendering.getCodingSchemeSummary().getFormalName());
		}
	}

	public static void main(String[] args) {
		try {
			new MavenBasedPrototype().run();
		} catch (LBInvocationException e) {
			e.printStackTrace();
		}
	}
}

...

The distributed LexEVS API environment will be configured on the LexEVS Server currently at (httphttps://lexevsapi6.nci.nih.gov/lexevsapi64/).

LexEVS Annotations

To address LexEVS DAOs, the LexEVS API integration incorporates:

...

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.

 

LexEVSDataService

Warning
titleRemoved 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:

  1. Ensure that the client application has access to the objects in the domain space.
  2. Formulate the query criteria using the domain objects.
  3. Establish a connection to the server.
  4. Submit the query objects and specify the desired class of objects to be returned.
  5. 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.

This graphic shows the search mechanism to access the NCI EVS vocabularies.Image Removed

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:

  1. 'CodingScheme' - Restricts the query to the specified Coding Scheme, instead of querying every available Coding Scheme.
  2. CodingSchemeVersionOrTag' - Restricts the query to the specified Version of the Coding Scheme.

    Info
    titleNote

    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.

  3. '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.
  4. '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.

    Info
    titleNote

    Lazy Loading may only be used in conjunction with specifying a Coding Scheme and Version with the 'CodingScheme' and 'CodingSchemeVersionOrTag' attributes above.

  5. '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.
This method returns a List Collection. This list will contain all of the 'Entity' Objects that match the search critieria. It this case, it will return all 'Entity' Objects with an 'entityCode' of "C1234".

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.
This method returns a List Collection. This list will contain all of the 'Entity' Objects that match the search critieria, while being further modified by the QueryOptions. It this case, it will return all 'Entity' Objects with an 'entityCode' of "C1234" belonging to the CodingScheme "NCI Thesaurus" Version "09.10d".

Warning
titleRemoved in 6.5. See CTS2 API
Web Services 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.

Warning
titleRemoved 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:

Code Block
<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.

Warning
titleRemoved in 6.5. See CTS2 API
XML-HTTP 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:

Code Block
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

...

server

...

Name of the Web server on which the caCORE LexEVS 6.0 Web application is deployed.

...

Yes

...

lexevsapi60.nci.nih.gov/lexevsapi60

...

servlet

...

URI and name of the servlet that will accept the HTTP GET requests.

...

Yes

...

lexevsapi60/GetXML
lexevsapi60/GetHTML

...

returnClass

...

Class name indicating the type of objects that this query should return.

...

Yes

...

query=DescLogicConcept

...

criteria

...

Search request criteria describing the requested objects.

...

Yes

...

DescLogicConcept @id=2

...

index

...

Starting index of the result set (Zero based).

...

No

...

startIndex=25

...

codingSchemeName

...

Restrict the query to a specific Coding Scheme Name.

...

No

...

{{codingSchemeName=NCI_Thesaurus }}

...

codingSchemeVersion

...

Restrict the query to a specific Coding Scheme Version.

...

No

Info
titleNote

Must be used in conjunction with a 'codingSchemeName'

...

codingSchemeVersion=09.12d

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

Code Block
{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

...

ClassName

...

The name of a class.

...

Entity

...

attributeName

...

The name of an attribute of the return class or an associated class

...

_entityCode

...

value

...

.

...

C123*

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.

Info
titleNote

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

...

Code Block
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.

...

titleNote

...

 

 

Scrollbar
iconsfalse