本文整理汇总了Java中gov.nih.nci.evs.browser.utils.RemoteServerUtil类的典型用法代码示例。如果您正苦于以下问题:Java RemoteServerUtil类的具体用法?Java RemoteServerUtil怎么用?Java RemoteServerUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RemoteServerUtil类属于gov.nih.nci.evs.browser.utils包,在下文中一共展示了RemoteServerUtil类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
args = parse(args);
LexBIGService lbs = RemoteServerUtil.createLexBIGService();
CodedNodeSet cns =
lbs.getCodingSchemeConcepts("NCI MetaThesaurus", null);
cns =
cns.restrictToMatchingDesignations("single dose",
SearchDesignationOption.ALL, "LuceneQuery", null);
CodedNodeGraph cng = lbs.getNodeGraph("NCI MetaThesaurus", null, null);
cng = cng.restrictToTargetCodes(cns);
ResolvedConceptReferenceList list =
cng.resolveAsList(null, true, false, 0, 0, null, null, null, null,
500);
for (ResolvedConceptReference ref : list.getResolvedConceptReference()) {
System.out.println("Code: " + ref.getCode());
System.out.println(" Entity Description"
+ ref.getEntityDescription().getContent());
}
}
示例2: getConceptByCode
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
/**
* Get concept Entity by code
* @param codingScheme
* @param code
* @return
*/
public ResolvedConceptReference getConceptByCode(String codingScheme, String version,
String code) {
CodedNodeSet cns = null;
ResolvedConceptReferencesIterator iterator = null;
try {
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
if (version != null) csvt.setVersion(version);
cns = lbSvc.getCodingSchemeConcepts(codingScheme, csvt);
ConceptReferenceList crefs =
createConceptReferenceList(new String[] { code }, codingScheme);
cns.restrictToCodes(crefs);
iterator = cns.resolve(null, null, null);
if (iterator.numberRemaining() > 0) {
ResolvedConceptReference ref = (ResolvedConceptReference) iterator.next();
return ref;
}
} catch (LBException e) {
_logger.info("Error: " + e.getMessage());
}
return null;
}
示例3: getAssociationNames
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
/**
* Return a list of Association names
*
* @param scheme
* @param version
* @return
*/
public Vector<String> getAssociationNames(String scheme, String version) {
Vector<String> association_vec = new Vector<String>();
try {
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
versionOrTag.setVersion(version);
CodingScheme cs = lbSvc.resolveCodingScheme(scheme, versionOrTag);
SupportedHierarchy[] hierarchies = cs.getMappings().getSupportedHierarchy();
String[] ids = hierarchies[0].getAssociationNames();
for (int i = 0; i < ids.length; i++) {
if (!association_vec.contains(ids[i])) {
association_vec.add(ids[i]);
_logger.debug("AssociationName: " + ids[i]);
}
}
} catch (Exception ex) {
_logger.warn(ex.getMessage());
}
return association_vec;
}
示例4: getSchemeVersions
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
/**
* Returns list of all versions associated with a scheme
* @param uri
* @return
* @throws Exception
*/
public ArrayList<String> getSchemeVersions(String uri) throws Exception {
ArrayList<String> list = new ArrayList<String>();
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
CodingSchemeRenderingList csrl = lbSvc.getSupportedCodingSchemes();
CodingSchemeRendering[] csrs = csrl.getCodingSchemeRendering();
for (int i = 0; i < csrs.length; i++) {
CodingSchemeRendering csr = csrs[i];
String status = csr.getRenderingDetail().getVersionStatus().value();
CodingSchemeSummary css = csr.getCodingSchemeSummary();
if (status.equals("active")) {
if (css.getCodingSchemeURI().equals(uri))
list.add(css.getRepresentsVersion());
}
}
return list;
}
示例5: search
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
public static void search(String searchString, String searchAlgorithm,
int resolveCodedEntryDepth,
int resolveAssociationDepth, int maxToReturn, boolean printList)
throws Exception {
LexBIGService lbs = RemoteServerUtil.createLexBIGService();
String codingScheme = "NCI MetaThesaurus";
System.out.println("----------------------------------------");
System.out.println("* searchString: " + searchString
+ ", searchAlgorithm: " + searchAlgorithm);
System.out.println("* resolveCodedEntryDepth: "
+ resolveCodedEntryDepth + ", resolveAssociationDepth: "
+ resolveAssociationDepth + ", maxToReturn: " + maxToReturn);
CodedNodeSet cns = lbs.getCodingSchemeConcepts(codingScheme, null);
cns =
cns.restrictToMatchingDesignations(searchString,
SearchDesignationOption.ALL, searchAlgorithm, null);
CodedNodeGraph cng = lbs.getNodeGraph(codingScheme, null, null);
cng = cng.restrictToTargetCodes(cns);
ResolvedConceptReferenceList list =
cng.resolveAsList(null, true, false, resolveCodedEntryDepth,
resolveAssociationDepth, null, null, null, null, maxToReturn);
int size = list.getResolvedConceptReferenceCount();
int i = 0;
if (printList) {
for (ResolvedConceptReference ref : list
.getResolvedConceptReference()) {
System.out.println((i++) + ") " + ref.getCode() + ": "
+ ref.getEntityDescription().getContent());
}
}
System.out.println("size: " + size);
System.out.println("");
}
示例6: getCodingSchemeDirection
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
/**
* Determine direction of Coding Scheme
*
* @param ref
* @return
* @throws LBException
*/
public Direction getCodingSchemeDirection(ResolvedConceptReference ref)
throws Exception {
Direction direction = Direction.FORWARD;
// Create a version object
CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
versionOrTag.setVersion(ref.getCodingSchemeVersion());
// Get Coding Scheme
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
CodingScheme cs = lbSvc.resolveCodingScheme(ref.getCodingSchemeName(), versionOrTag);
if (cs == null) {
throw new Exception("getTreeDirection(): CodingScheme is null!");
}
// Get hierarchy
SupportedHierarchy[] hierarchies = cs.getMappings().getSupportedHierarchy();
if (hierarchies == null || hierarchies.length < 1) {
throw new Exception("getTreeDirection(): hierarchies is null!");
}
if (hierarchies[0].isIsForwardNavigable())
direction = Direction.REVERSE;
else
direction = Direction.FORWARD;
_logger.debug("getTreeDirection() = " + direction);
return direction;
}
示例7: getAssociatedConcepts
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
/**
* Returns Associated Concepts
*
* @param scheme
* @param version
* @param code
* @param assocName
* @param forward
* @return
*/
public Vector<Entity> getAssociatedConcepts(String scheme, String version,
String code, Vector<String> assocNames, boolean forward) {
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
if (version != null) csvt.setVersion(version);
boolean resolveForward = true;
boolean resolveBackward = false;
// Set backward direction
if (!forward) {
resolveForward = false;
resolveBackward = true;
}
Vector<Entity> v = new Vector<Entity>();
try {
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
// Restrict coded node graph to the given association
NameAndValueList nameAndValueList = createNameAndValueList(
assocNames, null);
cng = cng.restrictToAssociations(nameAndValueList, null);
ConceptReference graphFocus =
ConvenienceMethods.createConceptReference(code, scheme);
ResolvedConceptReferencesIterator iterator =
codedNodeGraph2CodedNodeSetIterator(cng, graphFocus,
resolveForward, resolveBackward, RESOLVEASSOCIATIONDEPTH,
MAXTORETURN);
v = resolveIterator(iterator, MAXTORETURN, code);
} catch (Exception ex) {
_logger.warn(ex.getMessage());
}
return v;
}
示例8: run
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
public void run(String code) throws LBException {
//CodingSchemeSummary css = Util.promptForCodeSystem();
long ms = System.currentTimeMillis();
try {
//if (css != null) {
//LexBIGService lbSvc = LexBIGServiceImpl.defaultInstance();
LexBIGService lbsvc = RemoteServerUtil.createLexBIGService();
LexBIGServiceConvenienceMethods lbscm = (LexBIGServiceConvenienceMethods) lbsvc
.getGenericExtension("LexBIGServiceConvenienceMethods");
lbscm.setLexBIGService(lbsvc);
// Fetch the description for the specified code.
// Not required to find path to root, just nice to display.
String scheme = "NCI Thesaurus";//css.getCodingSchemeURI();
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
//csvt.setVersion(css.getRepresentsVersion());
String desc = null;
try {
desc = lbscm.createCodeNodeSet(new String[] { code }, scheme, csvt).resolveToList(null, null, null,
1).getResolvedConceptReference(0).getEntityDescription().getContent();
} catch (Exception e) {
desc = "<not found>";
}
Util_displayMessage("============================================================");
Util_displayMessage("Focus code: " + code + ":" + desc);
Util_displayMessage("============================================================");
// Iterate through all hierarchies ...
String[] hierarchyIDs = lbscm.getHierarchyIDs(scheme, csvt);
for (int i = 0; i < hierarchyIDs.length; i++) {
String hierarchyID = hierarchyIDs[i];
Util_displayMessage("------------------------------------------------------------");
Util_displayMessage("Hierarchy ID: " + hierarchyID);
Util_displayMessage("------------------------------------------------------------");
AssociationList associations = lbscm.getHierarchyPathToRoot(scheme, csvt, hierarchyID, code, false,
LexBIGServiceConvenienceMethods.HierarchyPathResolveOption.ALL, null);
for (int j = 0; j < associations.getAssociationCount(); j++) {
Association association = associations.getAssociation(j);
printChain(association, 0);
}
Util_displayMessage("");
}
//}
} finally {
System.out.println("Run time (ms): " + (System.currentTimeMillis() - ms));
}
}
示例9: main
import gov.nih.nci.evs.browser.utils.RemoteServerUtil; //导入依赖的package包/类
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Example: BuildTreeForCode \"C0000,C0001\"");
return;
}
try {
// Prompt for a coding scheme to run against...
//CodingSchemeSummary css = Util.promptForCodeSystem();
//if (css != null) {
// Declare common service classes for processing ...
//LexBIGService lbsvc = LexBIGServiceImpl.defaultInstance();
LexBIGService lbsvc = RemoteServerUtil.createLexBIGService();
LexBIGServiceConvenienceMethods lbscm = (LexBIGServiceConvenienceMethods) lbsvc
.getGenericExtension("LexBIGServiceConvenienceMethods");
lbscm.setLexBIGService(lbsvc);
// Pull the URI and version from the selected value ...
String scheme = "NCI Thesaurus";//css.getCodingSchemeURI();
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
// For any given ontology, we know the hierarchy
// information. But to keep the code as generic
// as possible and protect against changes, we
// resolve the supported hierarchy info from the
// coding scheme...
String hierarchyID = args.length > 1 ? args[1] : "is_a";
SupportedHierarchy hierarchyDefn = getSupportedHierarchy(lbsvc, scheme, csvt, hierarchyID);
// Loop through each provided code.
// The time to produce the tree for each code is printed in
// milliseconds. In order to factor out costs of startup
// and shutdown, resolving multiple codes may offer a
// better overall estimate performance.
String[] codes = args[0].split(",");
BuildTreeForCode test = new BuildTreeForCode();
for (String code : codes)
{
long ms = System.currentTimeMillis();
test.run(code);
System.out.println("===========================================================");
test.run(lbsvc, lbscm, scheme, csvt, hierarchyDefn, code);
System.out.println("Round trip -- Run time (milliseconds): " + (System.currentTimeMillis() - ms) );
}
//}
} catch (Exception e) {
Util_displayAndLogError("REQUEST FAILED !!!", e);
}
}