![]() |
Page History
Code Block | ||||
---|---|---|---|---|
| ||||
public class Test { /** * Initialize program variables */ private String codingScheme = null; private String version = null; import org.LexGrid.LexBIG.LexBIGService.LexBIGService; import org.LexGrid.LexBIG.Utility.Constructors; import org.LexGrid.LexBIG.caCore.interfaces.LexEVSApplicationService; import org.LexGrid.codingSchemes.CodingScheme; import gov.nih.nci.system.client.ApplicationServiceProvider; public class Test { LexBIGService lbSvc; public void Testrun(String codingScheme, String version) { // Set the LexEVS URL (for remote access) String evsUrl = "httphttps://lexevsapilexevsapi65.nci.nih.gov/lexevsapi50/http/remoteServicelexevsapi65"; boolean isRemote = true; this.codingScheme = codingScheme; this.version = version; // Get the LexBIG service reference from LexEVS Application Service lbSvc = (LexEVSApplicationService)ApplicationServiceProvider.getApplicationServiceFromUrl(evsUrl, "EvsServiceInfo"); // Set the vocabulary to work with Boolean retval = adapter.setVocabulary(codingScheme); codingSchemeMap = new HashMap(); try { // Using the LexBIG service, get the supported coding schemes CodingSchemeRenderingList csrl = lbSvc.getSupportedCodingSchemes(); // Get the coding scheme rendering CodingSchemeRendering[] csrs = csrl.getCodingSchemeRendering(LexEVSApplicationService); // For each coding scheme rendering... for (int i=0; i<csrs.length; i++) { ApplicationServiceProvider.getApplicationServiceFromUrl(evsUrl, CodingSchemeRendering csr = csrs[i]; // Determine whether the coding scheme rendering is active or not Boolean isActive = csr.getRenderingDetail().getVersionStatus().equals(CodingSchemeVersionStatus.ACTIVE) "EvsServiceInfo"); } if (isActive != null && isActive.equals(Boolean.TRUE))catch (Exception e1) { // Get the coding scheme summary CodingSchemeSummary css = csr.getCodingSchemeSummarye1.printStackTrace(); // Get the coding scheme formal name } String formalname = css.getFormalName(); //Get the coding scheme version String representsVersion = css.getRepresentsVersion(); CodingSchemeVersionOrTag vt = new; CodingSchemeVersionOrTag(); vt.setVersion(representsVersion); // Resolve coding scheme based on the formal name Resolve Scheme CodingScheme scheme = null; try { CodingScheme scheme = lbSvc.resolveCodingScheme(formalnamecodingScheme, vt); if (scheme != null){ codingSchemeMap.put((Object) formalname, (Object) scheme); Constructors.createCodingSchemeVersionOrTagFromVersion(version)); } } catch (Exception e) { // Resolve coding scheme based on the URI String uri = css.getCodingSchemeURI(); try { scheme = lbSvc.resolveCodingScheme(uri, vt); if (scheme != null) { codingSchemeMap.put((Object) formalname, (Object) scheme); } } catch (Exception ex) { String localname = css.getLocalName(); // Resolve coding scheme based on the local name try { scheme = lbSvc.resolveCodingScheme(localname, vtSystem.out.println("Found scheme: " + scheme.getCodingSchemeName()); if(scheme != null)}else { codingSchemeMap.put((Object) formalname, (Object) scheme); } } catch (Exception e2) { System.out.println("Scheme not found: " + codingScheme); } } } } } } catch (Exception e) { e.printStackTrace(); } } /** * Main */ public static void main (String[] args) { String name = "NCI Thesaurus"; String version = "0618.12d03d"; // Instantiate the Test Class Test test = new Test().run(name, version); } } |