Skip to content
This repository was archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3 from NCIEVS/master
Browse files Browse the repository at this point in the history
NCI Term Browser 2.9.1 release
  • Loading branch information
fragosog authored Dec 8, 2016
2 parents 446d0e0 + 809e924 commit aabb73b
Show file tree
Hide file tree
Showing 70 changed files with 2,901 additions and 5,001 deletions.
Binary file modified software/browser-util/browser-util.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package gov.nih.nci.evs.browser.bean;

import java.io.*;
import java.util.*;
import java.net.*;

public class DelimitedString
{

// Variable declaration
private String line;
private char delimiter;
private Vector values;
private int length;
private int sortIndex;

// Default constructor
public DelimitedString() {
}

// Constructor
public DelimitedString(
String line,
char delimiter,
Vector values,
int length) {

this.line = line;
this.delimiter = delimiter;
this.values = values;
this.length = length;
}

public void setSortIndex(int sortIndex) {
this.sortIndex = sortIndex;
}

// Set methods
public void setLine(String line) {
this.line = line;
}

public void setDelimiter(char delimiter) {
this.delimiter = delimiter;
}

public void setValues(Vector values) {
this.values = values;
}

public void setLength(int length) {
this.length = length;
}


// Get methods
public int getSortIndex() {
return this.sortIndex;
}

public String getLine() {
return this.line;
}

public char getDelimiter() {
return this.delimiter;
}

public Vector getValues() {
return this.values;
}

public int getLength() {
return this.length;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public boolean getTimeout() {
return _timeout;
}

/*
public void initialize() {
MappingData mappingData = null;
Expand Down Expand Up @@ -346,6 +347,187 @@ public void initialize() {
ex.printStackTrace();
}
}
*/


public void initialize() {

MappingData mappingData = null;

String sourceCode = null;
String sourceName = null;
String sourceCodingScheme = null;
String sourceCodingSchemeVesion = null;
String sourceCodeNamespace = null;
String associationName = null;
String rel = null;
int score = 0;
String targetCode = null;
String targetName = null;
String targetCodingScheme = null;
String targetCodingSchemeVesion = null;
String targetCodeNamespace = null;

String source_ns = null;
String target_ns = null;


try {
if (_iterator == null) {
_size = 0;
} else {
_list = new ArrayList();
_size = _iterator.numberRemaining();


//KLO, work-around #2
int knt = 0;
while (_iterator.hasNext()) {
knt++;
if (knt > INITIAL_ITERATOR_RESOLUTION) break;

ResolvedConceptReference ref = _iterator.next();

_lastResolved++;

//upper_bound = _lastResolved;

String description;

if(ref.getEntityDescription() == null) {
description = "NOT AVAILABLE";
} else {
description = ref.getEntityDescription().getContent();
}
sourceCode = ref.getCode();
sourceName = description;
sourceCodingScheme = ref.getCodingSchemeName();
sourceCodingSchemeVesion = ref.getCodingSchemeVersion();
sourceCodeNamespace = ref.getCodeNamespace();

rel = null;
score = 0;

AssociationList assocs = ref.getSourceOf();
if(assocs != null){
for(Association assoc : assocs.getAssociation()){
associationName = assoc.getAssociationName();
int lcv = 0;
for(AssociatedConcept ac : assoc.getAssociatedConcepts().getAssociatedConcept()){
lcv++;
if(ac.getEntityDescription() == null) {
description = "NOT AVAILABLE";
} else {
description = ac.getEntityDescription().getContent();
}
targetCode = ac.getCode();
targetName = description;
targetCodingScheme = ac.getCodingSchemeName();
targetCodingSchemeVesion = ac.getCodingSchemeVersion();
targetCodeNamespace = ac.getCodeNamespace();

if (ac.getAssociationQualifiers() != null && ac.getAssociationQualifiers().getNameAndValue() != null) {
for (NameAndValue qual : ac.getAssociationQualifiers().getNameAndValue()) {
String qualifier_name = qual.getName();
String qualifier_value = qual.getContent();
if (qualifier_name.compareTo("rel") == 0) {
rel = qualifier_value;
} else if (qualifier_name.compareTo("score") == 0) {
score = Integer.parseInt(qualifier_value);
}
}
}

mappingData = new MappingData(
sourceCode,
sourceName,
sourceCodingScheme,
sourceCodingSchemeVesion,
sourceCodeNamespace,
associationName,
rel,
score,
targetCode,
targetName,
targetCodingScheme,
targetCodingSchemeVesion,
targetCodeNamespace);

_list.add(mappingData);

}
}
}

assocs = ref.getTargetOf();
if(assocs != null){
for(Association assoc : assocs.getAssociation()){
associationName = assoc.getAssociationName();

int lcv = 0;
for(AssociatedConcept ac : assoc.getAssociatedConcepts().getAssociatedConcept()){
lcv++;
if(ac.getEntityDescription() == null) {
description = "NOT AVAILABLE";
} else {
description = ac.getEntityDescription().getContent();
}
targetCode = ac.getCode();
targetName = description;
targetCodingScheme = ac.getCodingSchemeName();
targetCodingSchemeVesion = ac.getCodingSchemeVersion();
targetCodeNamespace = ac.getCodeNamespace();

if (ac.getAssociationQualifiers() != null && ac.getAssociationQualifiers().getNameAndValue() != null) {
for (NameAndValue qual : ac.getAssociationQualifiers().getNameAndValue()) {
String qualifier_name = qual.getName();
String qualifier_value = qual.getContent();
if (qualifier_name.compareTo("rel") == 0) {
rel = qualifier_value;
} else if (qualifier_name.compareTo("score") == 0) {
score = Integer.parseInt(qualifier_value);
}
}
}

mappingData = new MappingData(
sourceCode,
sourceName,
sourceCodingScheme,
sourceCodingSchemeVesion,
sourceCodeNamespace,
associationName,
rel,
score,
targetCode,
targetName,
targetCodingScheme,
targetCodingSchemeVesion,
targetCodeNamespace);
_list.add(mappingData);
}
}
}

}
if (knt > _size) _size = knt;
}


_pageNumber = 1;
//_list = new ArrayList();

_pageSize = Constants.DEFAULT_PAGE_SIZE;
_numberOfPages = _size / _pageSize;
if (_pageSize * _numberOfPages < _size) {
_numberOfPages = _numberOfPages + 1;
}
_lastResolved = -1;
} catch (Exception ex) {
ex.printStackTrace();
}
}


public int getMumberOfPages() {
return _numberOfPages;
Expand Down Expand Up @@ -382,21 +564,6 @@ public int getEndIndex(int pageNumber) {
}


/*
public List copyData(int idx1, int idx2) {
List arrayList = new ArrayList();
int upper = idx2;
int max = _list.size();
if (max < idx2) upper = max;
for (int i=idx1; i<upper; i++) {
MappingData mappingData = (MappingData) _list.get(i);
arrayList.add(mappingData);
}
return arrayList;
}
*/

public List copyData(int idx1, int idx2) {
List arrayList = new ArrayList();

Expand Down Expand Up @@ -601,25 +768,8 @@ public List getData(int idx1, int idx2) {
}
}
}

}

// _list.set(_lastResolved, ref);
//_list.add(ref);

}
/*
dt = System.currentTimeMillis() - ms;
ms = System.currentTimeMillis();
total_delay = total_delay + dt;
//if (total_delay > (long) (NCItBrowserProperties.getPaginationTimeOut() * 60 * 1000)) {
if (total_delay > Constants.MILLISECONDS_PER_MINUTE * NCItBrowserProperties.getPaginationTimeOut()) {
_timeout = true;
_logger.debug("Time out at: " + _lastResolved);
break;
}
*/

}


Expand All @@ -631,42 +781,6 @@ public List getData(int idx1, int idx2) {
_size = _list.size();
}
return copyData(idx1, idx2);
/*
List rcr_list = new ArrayList();
if (_list.size() == 0) return rcr_list;
//for (int i = idx1; i <= idx2; i++) {
for (int i = idx1; i <= upper_bound; i++) {
if (i > _size) break;
MappingData rcr =
(MappingData) _list.get(i);
temp_vec.add(rcr);
//if (i > _lastResolved)
// break;
}
for (int i = 0; i < temp_vec.size(); i++) {
MappingData rcr =
(MappingData) temp_vec.elementAt(i);
rcr_list.add(rcr);
}
_logger.debug("getData Run time (ms): "
+ (System.currentTimeMillis() - ms));
return rcr_list;
//return copyData(idx1, idx2);
*/

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ public class Constants {

public static final String NO_ROOT_NODES_AVAILABLE = "No root nodes available";

public static final String MODE_EXPAND = "1";
public static final String MODE_COLLAPSE = "2";

/**
* Constructor
*/
Expand Down
Loading

0 comments on commit aabb73b

Please sign in to comment.