NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

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

...

Section
Column
Panel
titleContents of this Page
Table of Contents
minLevel2

 

 

 

LexEVS Authoring Service Management Methods

...

The following examples show how to insert an entity and update an existing entity.

Insert Entity

Code Block
 private VersionableEventEntityService service;
 private AuthoringService authoringService;
 
 CodingScheme scheme = new CodingScheme();
 scheme.setApproxNumConcepts(111l);
 scheme.setCodingSchemeName("testName");
 scheme.setCodingSchemeURI("uri");
 scheme.setRepresentsVersion("v1");
        
 authoringService.loadRevision(scheme, null, null);
        
 CodingScheme cs = codingSchemeservice.getCodingSchemeByUriAndVersion("uri", "v1");
 System.out.println(cs);
        
 Entity entity = new Entity();
 entity.setEntityCode("c1");
 entity.setEntityCodeNamespace("ns");
        
 service.insertEntity("uri", "v1", entity);

Updating an Existing Entity

Code Block
    private VersionableEventEntityService service;
	private AuthoringService authoringService;


	CodingScheme scheme = new CodingScheme();
    scheme.setApproxNumConcepts(111l);
    scheme.setCodingSchemeName("testName");
    scheme.setCodingSchemeURI("uri");
    scheme.setRepresentsVersion("v1");
        
    authoringService.loadRevision(scheme, null, null);
        
    CodingScheme cs = codingSchemeservice.getCodingSchemeByUriAndVersion("uri", "v1");
    System.out.println(cs);
     
    // Create a new entity   
    Entity entity = new Entity();
    entity.setEntityCode("c1");
    entity.setEntityCodeNamespace("ns");
    entity.setIsDefined(false);
       
    EntryState entryState = new EntryState();
    entryState.setChangeType(ChangeType.MODIFY);
    entity.setEntryState(entryState);
        
    EntityDescription ed = new EntityDescription();
    ed.setContent("pre-update");
    entity.setEntityDescription(ed);
      
    // Insert the new entity
    service.insertEntity("uri", "v1", entity);
       
    // Update the entity description
    entity.getEntityDescription().setContent("post-update");
      
    try {
		// Update the entity
        service.updateEntity("uri", "v1", entity);
    } catch (Exception e) {
     
    }

    Entity modifiedEntity = service.getEntity("uri", "v1", "c1", "ns");

Insert Entity

Code Block
    private VersionableEventEntityService service;
	private AuthoringService authoringService;
 
    CodingScheme scheme = new CodingScheme();
    scheme.setApproxNumConcepts(111l);
    scheme.setCodingSchemeName("testName");
    scheme.setCodingSchemeURI("uri");
    scheme.setRepresentsVersion("v1");
        
    authoringService.loadRevision(scheme, null, null);
        
    CodingScheme cs = codingSchemeservice.getCodingSchemeByUriAndVersion("uri", "v1");
    System.out.println(cs);
        
    Entity entity = new Entity();
    entity.setEntityCode("c1");
    entity.setEntityCodeNamespace("ns");
        
    service.insertEntity("uri", "v1", entity);

 

Scrollbar
iconsfalse