Page History
Scrollbar | ||
---|---|---|
|
...
Page info | ||||
---|---|---|---|---|
|
This section describes the components of the caCORE LexEVS and the service interface layer provided by the EVS API architecture. It gives examples of how to use the EVS APIs. It also describes the Distributed LexBIG API and the Distributed LexBIG Adapter.
...
Code Block |
---|
1 public class Test { 2 /** 3 * Initialize program variables 4 */ 5 6 private String codingScheme = null; 7 private String version = null; 8 9 DLBAdapter adapter = null; 10 LexBIGService lbSvc; 11 12 public Test(String codingScheme, String version) 13 { 14 //Set the LexEVS URL (for remote access) 15 String evsUrl = "http://lexevsapi.nci.nih.gov/lexevsapi50/http/remoteService"; 16 17 boolean isRemote = true; 18 this.codingScheme = codingScheme; 19 this.version = version; 20 21 // Get the LexBIG service reference from LexEVS Application Service 22 lbSvc = (LexEVSApplicationService)ApplicationServiceProvider. getApplicationServiceFromUrl(evsUrl, "EvsServiceInfo"); 23 24 // Set the vocabulary to work with 25 Boolean retval = adapter.setVocabulary(codingScheme); 26 27 codingSchemeMap = new HashMap(); 28 try { 32 // Using the LexBIG service, get the supported coding schemes 33 CodingSchemeRenderingList csrl = lbSvc.getSupportedCodingSchemes(); 34 35 // Get the coding scheme rendering 36 CodingSchemeRendering[] csrs = csrl.getCodingSchemeRendering(); 37 38 // For each coding scheme rendering... 39 for (int i=0; i<csrs.length; i++) { 40 CodingSchemeRendering csr = csrs[i]; 41 42 // Determine whether the coding scheme rendering is active or not 43 Boolean isActive = csr.getRenderingDetail().getVersionStatus() .equals(CodingSchemeVersionStatus.ACTIVE); 44 if (isActive != null && isActive.equals(Boolean.TRUE)) { 45 46 // Get the coding scheme summary 47 CodingSchemeSummary css = csr.getCodingSchemeSummary(); 48 49 // Get the coding scheme formal name 50 String formalname = css.getFormalName(); 51 52 //Get the coding scheme version 53 String representsVersion = css.getRepresentsVersion(); 54 CodingSchemeVersionOrTag vt = new; 55 CodingSchemeVersionOrTag(); 56 vt.setVersion(representsVersion); 57 58 // Resolve coding scheme based on the formal name 59 CodingScheme scheme = null; 60 61 try { 62 scheme = lbSvc.resolveCodingScheme(formalname, vt); 63 if (scheme != null) 64 { 65 codingSchemeMap.put((Object) formalname, (Object) scheme); 66 } 67 } catch (Exception e) { 68 // Resolve coding scheme based on the URI 69 String uri = css.getCodingSchemeURI(); 70 try { 71 scheme = lbSvc.resolveCodingScheme(uri, vt); 72 if (scheme != null) 73 { 74 codingSchemeMap.put((Object) formalname, (Object) scheme); 75 } 76 } catch (Exception ex) { 77 String localname = css.getLocalName(); 78 79 // Resolve coding scheme based on the local name 80 try { 81 scheme = lbSvc.resolveCodingScheme(localname, vt); 82 if(scheme != null) 83 { 84 codingSchemeMap.put((Object) formalname, (Object) scheme); 85 } 86 } catch (Exception e2) { 87 } 88 } 89 } 90 } 91 } 92 } catch (Exception e) { 93 e.printStackTrace(); 94 } 95 } 96 97 /** 98 *Main 99 */ 100 public static void main (String[] args) 101 { 102 String name = "NCI Thesaurus"; 103 String version = "06.12d"; 104 105 // Instantiate the Test Class 106 Test test = new Test(name, version); 107 } 108} |
Wiki Markup |
Scrollbar | ||
---|---|---|
|