本文整理汇总了Java中org.LexGrid.naming.SupportedHierarchy类的典型用法代码示例。如果您正苦于以下问题:Java SupportedHierarchy类的具体用法?Java SupportedHierarchy怎么用?Java SupportedHierarchy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SupportedHierarchy类属于org.LexGrid.naming包,在下文中一共展示了SupportedHierarchy类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAssociationNames
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的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();
if (version != null) {
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;
}
示例2: getAssociationNames
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的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;
}
示例3: getHierarchyAssociationId
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的package包/类
public Vector getHierarchyAssociationId(String scheme, String version) {
Vector association_vec = new Vector();
try {
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
// Will handle secured ontologies later.
CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
versionOrTag.setVersion(version);
CodingScheme cs = lbSvc.resolveCodingScheme(scheme, versionOrTag);
Mappings mappings = cs.getMappings();
SupportedHierarchy[] hierarchies = mappings.getSupportedHierarchy();
java.lang.String[] ids = hierarchies[0].getAssociationIds();
for (int i=0; i<ids.length; i++)
{
if (!association_vec.contains(ids[i])) {
association_vec.add(ids[i]);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return association_vec;
}
示例4: driver
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的package包/类
public static void driver(String code) throws LBException {
AppService service = AppService.getInstance();
LexBIGService lbsvc = AppService.getLBSvc();
LexBIGServiceConvenienceMethods lbscm = service.getLBSCM();
String scheme = service.getScheme();
CodingSchemeVersionOrTag csvt = service.getCSVT();
String hierarchyID = "is_a";
SupportedHierarchy hierarchyDefn = getSupportedHierarchy(lbsvc, scheme, csvt, hierarchyID);
BuildTreeForCode2 test = new BuildTreeForCode2();
excelBuffer.replace(0, excelBuffer.length(), "");
excelPostBuffer.replace(0, excelPostBuffer.length(), "");
Util.StopWatch stopWatch = new Util.StopWatch();
test.process(code);
Util_displayMessage("===========================================================");
test.run(lbsvc, lbscm, scheme, csvt, hierarchyDefn, code);
long duration = stopWatch.duration();
println(stopWatch.getResult(duration) + " * Round trip");
excelBuffer.append(stopWatch.getSecondString(duration) + "\t");
excelBuffer.append(excelPostBuffer.toString());
excelPrintln(excelBuffer.toString());
println("");
}
示例5: getCodingSchemeDirection
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的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;
}
示例6: getTreePathData
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的package包/类
/**
* Prints the tree for an individual code.
*/
public HashMap getTreePathData(String scheme, String version, String hierarchyID, String code) throws LBException {
LexBIGService lbsvc = RemoteServerUtil.createLexBIGService();
LexBIGServiceConvenienceMethods lbscm = (LexBIGServiceConvenienceMethods) lbsvc
.getGenericExtension("LexBIGServiceConvenienceMethods");
lbscm.setLexBIGService(lbsvc);
if (hierarchyID == null) hierarchyID = "is_a";
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
if (version != null) csvt.setVersion(version);
SupportedHierarchy hierarchyDefn = getSupportedHierarchy(lbsvc, scheme, csvt, hierarchyID);
return getTreePathData(lbsvc, lbscm, scheme, csvt, hierarchyDefn, code);
}
示例7: getSupportedHierarchy
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的package包/类
/**
* Returns a description of the hierarchy defined by the given coding
* scheme and matching the specified ID.
*/
protected static SupportedHierarchy getSupportedHierarchy(LexBIGService lbsvc, String scheme,
CodingSchemeVersionOrTag csvt, String hierarchyID) throws LBException {
CodingScheme cs = lbsvc.resolveCodingScheme(scheme, csvt);
if (cs == null) {
throw new LBResourceUnavailableException("Coding scheme not found: " + scheme);
}
for (SupportedHierarchy h : cs.getMappings().getSupportedHierarchy())
if (h.getLocalId().equals(hierarchyID))
return h;
throw new LBResourceUnavailableException("Hierarchy not defined: " + hierarchyID);
}
示例8: run
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的package包/类
/**
* Prints the tree for an individual code.
*/
public void run(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, String scheme,
CodingSchemeVersionOrTag csvt, SupportedHierarchy hierarchyDefn, String focusCode) throws LBException {
// Print a header and define a new tree for the code being processed.
Util_displayMessage("============================================================");
Util_displayMessage("Focus code: " + focusCode);
Util_displayMessage("============================================================");
TreeItem ti = new TreeItem("<Root>", "Root node");
//long ms = System.currentTimeMillis();
Util.StopWatch stopWatch = new Util.StopWatch();
int pathsResolved = 0;
try {
// Resolve 'is_a' hierarchy info. This example will
// need to make some calls outside of what is covered
// by existing convenience methods, but we use the
// registered hierarchy to prevent need to hard code
// relationship and direction info used on lookup ...
String hierarchyID = hierarchyDefn.getLocalId();
//String[] associationsToNavigate = hierarchyDefn.getAssociationNames();
String[] associationsToNavigate = hierarchyDefn.getAssociationIds();
boolean associationsNavigatedFwd = hierarchyDefn.getIsForwardNavigable();
// Identify the set of all codes on path from root
// to the focus code ...
Map<String, EntityDescription> codesToDescriptions = new HashMap<String, EntityDescription>();
AssociationList pathsFromRoot = getPathsFromRoot(lbsvc, lbscm, scheme, csvt, hierarchyID, focusCode,
codesToDescriptions);
// Typically there will be one path, but handle multiple just in
// case. Each path from root provides a 'backbone', from focus
// code to root, for additional nodes to hang off of in our
// printout. For every backbone node, one level of children is
// printed, along with an indication of whether those nodes can
// be expanded.
for (Iterator<Association> paths = pathsFromRoot.iterateAssociation(); paths.hasNext();) {
addPathFromRoot(ti, lbsvc, lbscm, scheme, csvt, paths.next(), associationsToNavigate, associationsNavigatedFwd,
codesToDescriptions);
pathsResolved++;
}
} finally {
long duration = stopWatch.duration();
// println("Run time (milliseconds): " + (System.currentTimeMillis() - ms) +
// " to resolve " + pathsResolved + " paths from root.");
println(stopWatch.getResult(duration) +
" * To resolve " + pathsResolved + " paths from root.");
excelBuffer.append(pathsResolved + "\t");
excelBuffer.append(stopWatch.getSecondString(duration) + "\t");
}
// Print the result ..
printTree(ti, focusCode, 0);
}
示例9: run
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的package包/类
/**
* Prints the tree for an individual code.
*/
public void run(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, String scheme,
CodingSchemeVersionOrTag csvt, SupportedHierarchy hierarchyDefn, String focusCode) throws LBException {
// Print a header and define a new tree for the code being processed.
Util_displayMessage("============================================================");
Util_displayMessage("Focus code: " + focusCode);
Util_displayMessage("============================================================");
TreeItem ti = new TreeItem("<Root>", "Root node");
long ms = System.currentTimeMillis();
int pathsResolved = 0;
try {
// Resolve 'is_a' hierarchy info. This example will
// need to make some calls outside of what is covered
// by existing convenience methods, but we use the
// registered hierarchy to prevent need to hard code
// relationship and direction info used on lookup ...
String hierarchyID = hierarchyDefn.getLocalId();
//String[] associationsToNavigate = hierarchyDefn.getAssociationNames();
String[] associationsToNavigate = hierarchyDefn.getAssociationIds();
boolean associationsNavigatedFwd = hierarchyDefn.getIsForwardNavigable();
// Identify the set of all codes on path from root
// to the focus code ...
Map<String, EntityDescription> codesToDescriptions = new HashMap<String, EntityDescription>();
AssociationList pathsFromRoot = getPathsFromRoot(lbsvc, lbscm, scheme, csvt, hierarchyID, focusCode,
codesToDescriptions);
// Typically there will be one path, but handle multiple just in
// case. Each path from root provides a 'backbone', from focus
// code to root, for additional nodes to hang off of in our
// printout. For every backbone node, one level of children is
// printed, along with an indication of whether those nodes can
// be expanded.
for (Iterator<Association> paths = pathsFromRoot.iterateAssociation(); paths.hasNext();) {
addPathFromRoot(ti, lbsvc, lbscm, scheme, csvt, paths.next(), associationsToNavigate, associationsNavigatedFwd,
codesToDescriptions);
pathsResolved++;
}
} finally {
System.out.println("Run time (milliseconds): " + (System.currentTimeMillis() - ms) +
" to resolve " + pathsResolved + " paths from root.");
}
// Print the result ..
printTree(ti, focusCode, 0);
}
示例10: main
import org.LexGrid.naming.SupportedHierarchy; //导入依赖的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);
}
}