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.

...

LexBIGService

HistoryService

<source lang = java> 

Code Block

		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();	

		try {

			HistoryService historSvc = lbsv.getHistoryService(codingScheme);<

		} catch (LBException e) {	

			e.printStackTrace();	

		}

</source> 

LexBIGServiceManager

<source lang = java> 

Code Block

                //LexBIG Service Manager can accept credentials validation to
                //preserve service security.
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		
		try {
			
			LexBIGServiceManager svcManager = lbsv.getServiceManager(credentials);
			
		} catch (LBException e) {
			e.printStackTrace();
		}

</source> 

LexEVSServiceMetaData

<source lang = java> 

Code Block

                // User safe service meta data query interface.
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		
		try {
			
			LexBIGServiceMetadata svcMetaData = lbsv.getServiceMetadata();
			
		} catch (LBException e) {
			e.printStackTrace();
		}

</source> 

LexEvsServiceLocator

SystemResourceService

<source lang = java> 

Code Block

 // The system resource service is commonly wrapped in LexBIGServiceManager calls
 // and as such it prevents unauthorized users from removing coding schemes from the service.
 SystemResourceService systemResourceService = LexEvsServiceLocator.getInstance().getSystemResourceService();
        // must be marked as inactive or pending before delete.
        systemResourceService.removeCodingSchemeResourceFromSystem(
                codingSchemeVersionReference.getCodingSchemeURN(),
                codingSchemeVersionReference.getCodingSchemeVersion());

</source> 

LexEvsIndexOperations

Some index operations can be accomplished using the interface returned from the LexEvsServiceLocator.

<source lang = java> 

Code Block

		boolean isSingleIndex = 
			LexEvsServiceLocator.getInstance().getSystemResourceService().getSystemVariables().getIsSingleIndex();
		
		if(! isSingleIndex) {
			throw new RuntimeException("Lucene Clean Up can only be executed in Single Index Mode.");
		}
		try {
			List<AbsoluteCodingSchemeVersionReference> expectedList = 
				new ArrayList<AbsoluteCodingSchemeVersionReference>();
			
			for(RegistryEntry entry :
				LexEvsServiceLocator.getInstance().getRegistry().getAllRegistryEntriesOfType(ResourceType.CODING_SCHEME)) {
				
				AbsoluteCodingSchemeVersionReference ref = new AbsoluteCodingSchemeVersionReference();
				ref.setCodingSchemeURN(entry.getResourceUri());
				ref.setCodingSchemeVersion(entry.getResourceVersion());
				
				expectedList.add(ref);
			}
			
			LexEvsServiceLocator.getInstance().getLexEvsIndexOperations().cleanUp(expectedList, reindexMissing);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

</source> 

EntityIndexService

Others operations require using the IndexServiceManager to retrieve a more specific index service

<source lang = java> 

Code Block

            AbsoluteCodingSchemeVersionReference acsvr = new  AbsoluteCodingSchemeVersionReference();
           
            acsvr.setCodingSchemeURN(css.getCodingSchemeURI());
            acsvr.setCodingSchemeVersion(css.getRepresentsVersion());
           
            LexEvsServiceLocator.getInstance().
            getIndexServiceManager().
                getEntityIndexService().dropIndex(acsvr);

</source> 

LexBIGService Administration Methods

...

Getting Filter Extensions:

<source lang=java> 

Code Block

        // LexEVS has no built-in filter extensions. This method call
        // will only return filters users have created themselves.
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		Enumeration<? extends ExtensionDescription> extDesc = lbsv.getFilterExtensions().enumerateExtensionDescription();
		while(extDesc.hasMoreElements()){
			System.out.println(extDesc.nextElement().getName());
		}

</source> 

Getting Sort Algorithms:

<source lang=java> 

Code Block

		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		Enumeration<? extends SortDescription> sortDesc = lbsv.getSortAlgorithms(null).enumerateSortDescription();
		while(sortDesc.hasMoreElements()){
			System.out.println(sortDesc.nextElement().getName());
		}

</source> 

Getting Match Algorithms:

<source lang=java> 

Code Block

	LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		Enumeration<? extends ModuleDescription> modDesc = lbsv.getMatchAlgorithms().enumerateModuleDescription();
		while(modDesc.hasMoreElements()){
			System.out.println(modDesc.nextElement().getName());
		}

</source> 

Sample Output:

Code Block

 SpellingErrorTolerantSubStringSearch
 StemmedLuceneQuery
 literalContains
 startsWith
 nonLeadingWildcardLiteralSubString
 literal
 WeightedDoubleMetaphoneLuceneQuery
 literalSubString
 DoubleMetaphoneLuceneQuery
 RegExp

Getting Generic Extensions:

<source lang=java> 

Code Block

		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		Enumeration<? extends ExtensionDescription> extDesc = lbsv.getGenericExtensions().enumerateExtensionDescription();
		while(extDesc.hasMoreElements()){
			System.out.println(extDesc.nextElement().getName());

		}

</source> 

Sample Output:

Code Block

 SupplementExtension
 LexBIGServiceConvenienceMethods
 ApproxNumOfConceptsPostProcessor
 MappingExtension
 SupportedAttributePostProcessor
 OntologyFormatAddingPostProcessor

Getting Service Information on all Schemes:

<source lang=java> 

Code Block

		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		try {
			CodingSchemeRenderingList schemes = lbsv.getSupportedCodingSchemes();
            for (CodingSchemeRendering csr : schemes.getCodingSchemeRendering()) {
                // Separator ...
                System.out.println("=============================");
                CodingSchemeSummary css = csr.getCodingSchemeSummary();
                CodingScheme cs = lbsv.resolveCodingScheme(css.getCodingSchemeURI(), Constructors
                        .createCodingSchemeVersionOrTagFromVersion(css.getRepresentsVersion()));
                System.out.println(ObjectToString.toString(cs, "", 80));}

		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Sample Output Excerpt

Code Block

 CodingScheme
    Name: MDR12_1_TO_CST95
    Formal Name: MDR12_1_TO_CST95
    URI: urn:oid:CL413321.MDR.CST
    Approximate Number of Concepts: 0
    Default Language: null
    Represents Version: 200909
    Local Names:
        Array of 1 items:
            MDR12_1_TO_CST95
    Mappings:
        MappingsSupportedAssociations:
                Array of 1 items:
                    SupportedAssociation
                        Local ID: mapped_to
                        Content: mapped_to
                        AssociationEntity CodingScheme: null
                        AssociationEntity EntityCodeNamespace: null
                        AssociationEntity EntityCode: null
            SupportedCodingSchemes: ...................................................

Getting Single Coding Scheme Information:

<source lang=java> 

Code Block

	public void run(){
		String codingScheme = "amino-acid.owl";	
		CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
		versionOrTag.setVersion("1.2");
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		try {
			CodingScheme cs = lbsv.resolveCodingScheme(codingScheme, versionOrTag );
            System.out.println(ObjectToString.toString(cs, "", 80));

		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Output same as above but for designated coding scheme only.

Getting a Coding Scheme's Copyright Content:

<source lang=java> 

Code Block

		String codingScheme = "amino-acid.owl";	
		CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
		versionOrTag.setVersion("1.2");
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
		try {
			String cpywrt = lbsv.resolveCodingSchemeCopyright(codingScheme, versionOrTag);
            System.out.println(cpywrt);

		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Output is unformatted text

...

Setting the Coding Scheme tag allows the system administrator to provide status tags or designate a preferred version of a given coding scheme for this terminology service.

<source lang=java> 

Code Block

AbsoluteCodingSchemeVersionReference codingSchemeVersion = 
     new AbsoluteCodingSchemeVersionReference();
codingSchemeVersion.setCodingSchemeURN("http://www.co-ode.org/ontologies/amino-acid/2005/10/11
/amino-acid.owl");
codingSchemeVersion.setCodingSchemeVersion("1.0");

		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();

		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
                        // PRODUCTION tagged  vocabularies are interpreted by LexEVS
                        // to be the preferred version of the vocabulary.
			lbsvm.setVersionTag(codingSchemeVersion, "PRODUCTION");

		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Activate Coding Scheme

The active designation for a coding scheme is required to enable query functionality for the contained entities and their relationships and properties.

<source lang=java> 

Code Block

AbsoluteCodingSchemeVersionReference codingSchemeVersion = 
    new AbsoluteCodingSchemeVersionReference();
codingSchemeVersion.setCodingSchemeURN("http://www.co-ode.org/ontologies/amino-acid/2005/10/1/amino-acid.owl");
codingSchemeVersion.setCodingSchemeVersion("1.0");
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();

		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			lbsvm.activateCodingSchemeVersion(codingSchemeVersion);

		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		

</source> 

Deactivate Coding Scheme

Allows administrator to restrict access to coding scheme metadata only.

<source lang=java> 

Code Block

AbsoluteCodingSchemeVersionReference codingSchemeVersion = 
    new AbsoluteCodingSchemeVersionReference();
codingSchemeVersion.setCodingSchemeURN("http://www.co-ode.org/ontologies/amino-acid/2005/10/1/amino-acid.owl");
codingSchemeVersion.setCodingSchemeVersion("1.0");
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
 
		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			lbsvm.deactivateCodingSchemeVersion(codingSchemeVersion, null);
 
		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();

</source> 

Remove Coding Scheme

Removes a coding scheme and it's indexes from a terminology service.

Warning
titleWarning

This is a slow, resource consuming activity when the service is configured for single table mode.

...

Code Block

AbsoluteCodingSchemeVersionReference codingSchemeVersion = 
    new AbsoluteCodingSchemeVersionReference();
codingSchemeVersion.setCodingSchemeURN("http://www.co-ode.org/ontologies/amino-acid/2005/10/1
/amino-acid.owl");
codingSchemeVersion.setCodingSchemeVersion("1.0");
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();
 
		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			lbsvm.removeCodingSchemeVersion(codingSchemeVersion);
 
		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
                {

</source> 

Remove History Service

Remove a history service from the terminology service.

<source lang=java> 

Code Block

		String codingScheme = "NCI Thesaurus";
		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();

		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			lbsvm.removeHistoryService(codingScheme);

		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Get Load Extensions

Allows a determination of available loaders by an administrator.

<source lang=java> 

Code Block

		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();

		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			 Enumeration<? extends ExtensionDescription> extDesc =
                         lbsvm.getLoadExtensions().enumerateExtensionDescription();
			 while(extDesc.hasMoreElements()){
				 System.out.println(extDesc.nextElement().getName());
			 }
		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Sample Output:

Code Block

 NCIMetaHistoryLoader
 OBOLoader
 HL7Loader
 ClaMLLoader
 SemNetLoader
 MrMap_Loader
 MetaDataLoader
 RadLexFramesLoader
 TextLoader
 NCIThesaurusHistoryLoader
 OWLLoader
 LexGrid_Loader

...

Returns a specific loader instance for use in loading the relevant source file.

<source lang=java> 

Code Block

            LexBIGService lbs = LexBIGServiceImpl.defaultInstance();
            LexBIGServiceManager lbsm = lbs.getServiceManager(null);
            LexGrid_Loader loader = (LexGrid_Loader) lbsm
                    .getLoader(org.LexGrid.LexBIG.Impl.loaders.LexGridMultiLoaderImpl.name);
                loader.setCodingSchemeManifestURI(manifest);
                loader.load(source, false, true);

</source> 

Get Extension Registry

Returns an extension registry service for all externally registered plugins to LexEVS. This provides similar functionality to the other registry retrieval, display and use and we won't repeat method examples here.

<source lang=java> 

Code Block

			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			 ExtensionRegistry registry = lbsvm.getExtensionRegistry();

</source> 

Get Export Extensions

Returns a list of Export extensions available as administrative functions to allow administrators to export a terminology to a specifically formatted output file.

<source lang=java> 

Code Block

		LexBIGService lbsv = LexBIGServiceImpl.defaultInstance();

		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			Enumeration<? extends ExtensionDescription> extDesc =
                        lbsvm.getExportExtensions().enumerateExtensionDescription();
			while(extDesc.hasMoreElements()){
				System.out.println(extDesc.nextElement().getName());
			}
		
		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Sample Output

Code Block

 LexGridExport
 OwlRdfExporter
 OBOExport

...

Returns an exporter for a specific output format.

<source lang=java> 

Code Block

            LexBIGService lbs = LexBIGServiceImpl.defaultInstance();
            LexBIGServiceManager lbsm = lbs.getServiceManager(null);

            // Find the registered extension handling this type of export ...
            OwlRdfExporterImpl exporter = (OwlRdfExporterImpl) lbsm.getExporter(OwlRdfExporterImpl.name);

            // Perform the requested action ...
            CnsCngPair cngCngPair = FilterParser.parse(lbs, css.getCodingSchemeURI(),
            css.getRepresentsVersion(), cl);
            exporter.setCng(cngCngPair.getCng());
            exporter.setCns(cngCngPair.getCns());
            exporter.export(Constructors.createAbsoluteCodingSchemeVersionReference(css),
            destination,overwrite,false, true);

</source> 

Remove Metadata

Remove external coding scheme metadata

<source lang=java> 

Code Block

                String urn = "urn:oid:11.00.11.1";
                String ver = "1.1";
                Enumeration<? extends CodingSchemeRendering> schemes = lbs.getSupportedCodingSchemes()
                        .enumerateCodingSchemeRendering();
                while (schemes.hasMoreElements() && css == null) {
                    CodingSchemeSummary summary = schemes.nextElement().getCodingSchemeSummary();
                    if (urn.equalsIgnoreCase(summary.getCodingSchemeURI())
                            && ver.equalsIgnoreCase(summary.getRepresentsVersion()))
                        css = summary;
                }
            }

          
                lbs.getServiceManager(null).removeCodingSchemeVersionMetaData(
                        Constructors.createAbsoluteCodingSchemeVersionReference(css));

</source> 

Register Coding Scheme Supplement

Register a coding scheme as a supplement to another coding scheme

<source lang=java> 

Code Block

		try {
			LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
			AbsoluteCodingSchemeVersionReference parentCodingScheme  = new
                        AbsoluteCodingSchemeVersionReference();
			AbsoluteCodingSchemeVersionReference supplementCodingScheme = new
                        AbsoluteCodingSchemeVersionReference();
			String codingSchemeURN = "urn:oid:11.11.0.1.1";
			String codingSchemeVersion = "1.0";
			String ExtensionCodingSchemeURN = "urn:oid:11.11.0.1.1-extension";
			String ExtensionCodingSchemeVersion = "1.0-extension";
			parentCodingScheme.setCodingSchemeURN(codingSchemeURN);
			parentCodingScheme.setCodingSchemeVersion(codingSchemeVersion);
			supplementCodingScheme.setCodingSchemeURN(ExtensionCodingSchemeURN);
			supplementCodingScheme.setCodingSchemeVersion(ExtensionCodingSchemeVersion);

			lbsvm.registerCodingSchemeAsSupplement(parentCodingScheme,supplementCodingScheme);
		
		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Remove a coding schemes relationship with another as a supplement.

Un-Register Coding Scheme Supplement

<source lang=java> 

Code Block

try {
	LexBIGServiceManager lbsvm = lbsv.getServiceManager(null);
	AbsoluteCodingSchemeVersionReference parentCodingScheme  = new
        AbsoluteCodingSchemeVersionReference();
	AbsoluteCodingSchemeVersionReference supplementCodingScheme = new
        AbsoluteCodingSchemeVersionReference();
	String codingSchemeURN = "urn:oid:11.11.0.1.1";
	String codingSchemeVersion = "1.0";
	String ExtensionCodingSchemeURN = "urn:oid:11.11.0.1.1-extension";
	String ExtensionCodingSchemeVersion = "1.0-extension";
	parentCodingScheme.setCodingSchemeURN(codingSchemeURN);
	parentCodingScheme.setCodingSchemeVersion(codingSchemeVersion);
	supplementCodingScheme.setCodingSchemeURN(ExtensionCodingSchemeURN);
	supplementCodingScheme.setCodingSchemeVersion(ExtensionCodingSchemeVersion);
 
			lbsvm.registerCodingSchemeAsSupplement(parentCodingScheme,supplementCodingScheme);
 
} catch (LBException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}

</source> 

LexEVS Authoring Service Management Methods

...

Create a Mapping Coding Scheme from Scratch

<source lang=java> 

Code Block

     LexEVSAuthoringService authoring = new LexEVSAuthoringServiceImpl();
    
	   EntryState entryState = new EntryState();
	   entryState.setChangeType(ChangeType.NEW);
	   entryState.setContainingRevision("FirstVersionNCItToICD9_12_1_54");
	   entryState.setRelativeOrder(new Long(1));
		
		//Minimum meta data for the mapping coding scheme should be defined here
		AbsoluteCodingSchemeVersionReference mappingCodingScheme = new AbsoluteCodingSchemeVersionReference();
		mappingCodingScheme.setCodingSchemeURN("urn:oid:11.0011.1.1");
		mappingCodingScheme.setCodingSchemeVersion("1.0");
		
		AbsoluteCodingSchemeVersionReference sourceCodingScheme = new AbsoluteCodingSchemeVersionReference();
		sourceCodingScheme.setCodingSchemeURN("http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#");
		sourceCodingScheme.setCodingSchemeVersion("10.10e");
		
		AbsoluteCodingSchemeVersionReference targetCodingScheme = new AbsoluteCodingSchemeVersionReference();
		targetCodingScheme.setCodingSchemeURN("urn:oid:2.16.840.1.113883.6.2");
		targetCodingScheme.setCodingSchemeVersion("200909");
		
		AssociationSource[] associationSource = new AssociationSource[2];
		
		
		String associationType = "mapped_to";
		String relationsContainerName = "relations";
		Date effectiveDate = new Date();

		Revision revision = new Revision();
		revision.setRevisionId(entryState.getContainingRevision());
		
		boolean loadEntities = false;
		try {
			authoring.createAssociationMapping(
					entryState, 
				    mappingCodingScheme,
					sourceCodingScheme, 
					targetCodingScheme,
					associationSource,
					associationType,
					relationsContainerName,
					effectiveDate,
					null,
					revision,
					false
					);
		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

</source> 

Create a Mapping Coding Scheme with Default Coding Scheme Values

<source lang=java> 

Code Block

		authoring.createMappingWithDefaultValues(sources, "NCI Thesaurus",
				"10.10a", "ICD9", "200909", "mapped_to", false);
		AbsoluteCodingSchemeVersionReference codingSchemeVersion = new
                AbsoluteCodingSchemeVersionReference();
		codingSchemeVersion
				.setCodingSchemeURN("http://default.mapping.container");
		codingSchemeVersion.setCodingSchemeVersion("1.0");
		lbsm.activateCodingSchemeVersion(codingSchemeVersion);

</source> 

CTS2 Management Methods

No further information provided

...