本文整理汇总了Java中org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference.getSourceOf方法的典型用法代码示例。如果您正苦于以下问题:Java ResolvedConceptReference.getSourceOf方法的具体用法?Java ResolvedConceptReference.getSourceOf怎么用?Java ResolvedConceptReference.getSourceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference
的用法示例。
在下文中一共展示了ResolvedConceptReference.getSourceOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: numOfChildren
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
protected int numOfChildren(String code) throws LBException {
ResolvedConceptReferenceList list = getMatches(code, HAS_SUBTYPE, false);
if (list.getResolvedConceptReferenceCount() <= 0)
return 0;
ResolvedConceptReference ref = (ResolvedConceptReference)
list.enumerateResolvedConceptReference().nextElement();
AssociationList aList = ref.getSourceOf();
Association[] associations = aList.getAssociation();
int n = 0;
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
n += acl.length;
}
return n;
}
示例2: print
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Prints the.
*
* @param ref the ref
* @param depth the depth
*/
private static void print(ResolvedConceptReference ref, int depth){
String code = ref.getConceptCode();
String description;
if(ref.getEntityDescription() != null){
description = ref.getEntityDescription().getContent();
} else {
description = "";
}
System.out.println(buildPrefix(depth) + "Code: " + code + ", Description: " + description + " Hash: " + ref.hashCode());
if(ref.getSourceOf() != null){
print(ref.getSourceOf(), depth+1);
}
if(ref.getTargetOf() != null){
print(ref.getTargetOf(), depth+1);
}
}
示例3: printTo
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Display relations from the given code to other concepts.
*
* @param code
* @param lbSvc
* @param scheme
* @param csvt
* @throws LBException
*/
@SuppressWarnings("unchecked")
protected void printTo(PrintWriter pw, String scheme, CodingSchemeVersionOrTag csvt, String code)
throws LBException {
pw.println("Points to ...");
// Perform the query ...
ResolvedConceptReferenceList matches = lbSvc.getNodeGraph(scheme, csvt, null).resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme), true, false, 1, 1, new LocalNameList(), null,
null, 1024);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
Enumeration<? extends ResolvedConceptReference> refEnum = matches.enumerateResolvedConceptReference();
while (refEnum.hasMoreElements()) {
ResolvedConceptReference ref = refEnum.nextElement();
AssociationList sourceof = ref.getSourceOf();
Association[] associations = sourceof.getAssociation();
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
pw.println("\t" + assoc.getAssociationName());
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
String rela = replaceAssociationNameByRela(ac, assoc.getAssociationName());
EntityDescription ed = ac.getEntityDescription();
pw.println("\t\t" + code + " --> (" + rela + ") --> " + ac.getConceptCode() + "/"
+ (ed == null ? "**No Description**" : ed.getContent()));
}
}
}
}
}
示例4: printTo
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
protected static void printTo(String code, String relation, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException
{
System.out.println("Points to ...");
// Perform the query ...
NameAndValue nv = new NameAndValue();
NameAndValueList nvList = new NameAndValueList();
nv.setName(relation);
nvList.addNameAndValue(nv);
ResolvedConceptReferenceList matches =
lbSvc.getNodeGraph(scheme, csvt, null)
.restrictToAssociations(nvList, null)
.resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme),
true, false, 1, 1, new LocalNameList(), null, null, 1024);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
ResolvedConceptReference ref =
(ResolvedConceptReference) matches.enumerateResolvedConceptReference().nextElement();
// Print the associations
AssociationList sourceof = ref.getSourceOf();
Association[] associations = sourceof.getAssociation();
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
EntityDescription ed = ac.getEntityDescription();
System.out.println(
"\t\t" + ac.getConceptCode() + "/"
+ (ed == null?
"**No Description**":ed.getContent()));
}
}
}
}
示例5: printTo
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Display relations from the given code to other concepts.
*
* @param code
* @param lbSvc
* @param scheme
* @param csvt
* @throws LBException
*/
@SuppressWarnings("unchecked")
protected void printTo(PrintWriter pw, String code, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException {
displayMessage(pw, "\n\tPoints to ...");
// Perform the query ...
ResolvedConceptReferenceList matches = lbSvc.getNodeGraph(scheme, csvt, null).resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme), true, false, 1, 1, new LocalNameList(), null,
null, 1024);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
Enumeration<? extends ResolvedConceptReference> refEnum = matches.enumerateResolvedConceptReference();
while (refEnum.hasMoreElements()) {
ResolvedConceptReference ref = refEnum.nextElement();
AssociationList sourceof = ref.getSourceOf();
if (sourceof != null) {
Association[] associations = sourceof.getAssociation();
if (associations != null && associations.length > 0) {
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
//displayMessage(pw, "\t" + assoc.getAssociationName());
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
String rela = replaceAssociationNameByRela(ac, assoc.getAssociationName());
EntityDescription ed = ac.getEntityDescription();
displayMessage(pw, "\t\t" + code + " --> (" + rela + ") --> " + ac.getConceptCode() + "/"
+ (ed == null ? "**No Description**" : ed.getContent()));
if (ac.getAssociationQualifiers() != null && ac.getAssociationQualifiers().getNameAndValue() != null) {
for(NameAndValue nv: ac.getAssociationQualifiers().getNameAndValue()){
displayMessage(pw, "\t\t\tAssoc Qualifier - " + nv.getName() + ": " + nv.getContent());
displayMessage(pw, "\n");
}
}
}
}
}
}
}
}
}
示例6: resolveOneHit
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
protected List<? extends ResolvedConceptReference> resolveOneHit(ResolvedConceptReference hit) throws LBException{
List<ResolvedConceptReference> returnList = new ArrayList<ResolvedConceptReference>();
CodingSchemeVersionOrTag tagOrVersion = new CodingSchemeVersionOrTag();
if (hit.getCodingSchemeVersion() != null) tagOrVersion.setVersion(hit.getCodingSchemeVersion());
CodedNodeGraph cng = null;
if (lbSvc == null) {
return null;
}
cng = lbSvc.getNodeGraph(
hit.getCodingSchemeName(),
tagOrVersion,
null);
Boolean restrictToAnonymous = Boolean.FALSE;
cng = cng.restrictToAnonymous(restrictToAnonymous);
LocalNameList localNameList = new LocalNameList();
localNameList.addEntry("concept");
cng = cng.restrictToEntityTypes(localNameList);
if (_associationNameAndValueList != null) {
cng =
cng.restrictToAssociations(
_associationNameAndValueList,
_associationQualifierNameAndValueList);
}
else {
String scheme = hit.getCodingSchemeName();
SimpleDataUtils simpleDataUtils = new SimpleDataUtils(lbSvc);
boolean isMapping = simpleDataUtils.isMapping(scheme, null);
if (isMapping) {
NameAndValueList navl = simpleDataUtils.getMappingAssociationNames(scheme, null);
if (navl != null) {
cng = cng.restrictToAssociations(navl, null);
}
}
}
ConceptReference focus = new ConceptReference();
focus.setCode(hit.getCode());
focus.setCodingSchemeName(hit.getCodingSchemeName());
focus.setCodeNamespace(hit.getCodeNamespace());
LocalNameList propertyNames = new LocalNameList();
CodedNodeSet.PropertyType[] propertyTypes = null;
SortOptionList sortCriteria = null;
ResolvedConceptReferenceList list =
cng.resolveAsList(focus,
_resolveForward, _resolveBackward, 0,
_resolveAssociationDepth, propertyNames, propertyTypes, sortCriteria,
_maxToReturn);
for(ResolvedConceptReference ref : list.getResolvedConceptReference()){
if (ref.getSourceOf() != null && this.getAssociations(ref.getSourceOf()).size() > 0) {
returnList.addAll(this.getAssociations(ref.getSourceOf()));
}
//if(ref.getSourceOf() != null){
// returnList.addAll(this.getAssociations(ref.getSourceOf()));
//}
if (ref.getTargetOf() != null && this.getAssociations(ref.getTargetOf()).size() > 0) {
returnList.addAll(this.getAssociations(ref.getTargetOf()));
}
//if(ref.getTargetOf() != null){
//returnList.addAll(this.getAssociations(ref.getTargetOf()));
//}
}
return returnList;
}
示例7: addChildren
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Populate child nodes for a single branch of the tree,
* and indicates whether further expansion (to grandchildren)
* is possible.
*/
protected void addChildren(TreeItem ti,
LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm,
String scheme, CodingSchemeVersionOrTag csvt,
String branchRootCode, Set<String> codesToExclude, String[] associationsToNavigate,
boolean associationsNavigatedFwd)
throws LBException {
// Resolve the next branch, representing children of the given
// code, navigated according to the provided relationship and
// direction. Resolve the children as a code graph, looking 2
// levels deep but leaving the final level unresolved.
CodedNodeGraph cng = lbsvc.getNodeGraph(scheme, csvt, null);
ConceptReference focus = Constructors.createConceptReference(branchRootCode, scheme);
cng = cng.restrictToAssociations(Constructors.createNameAndValueList(associationsToNavigate), null);
/*
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, true);
*/
// to be reversed after loading the patch
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, false);
// The resolved branch will be represented by the first node in
// the resolved list. The node will be subdivided by source or
// target associations (depending on direction). The associated
// nodes define the children.
for (Iterator<ResolvedConceptReference> nodes = branch.iterateResolvedConceptReference(); nodes.hasNext();) {
ResolvedConceptReference node = nodes.next();
AssociationList childAssociationList = associationsNavigatedFwd ? node.getSourceOf() : node.getTargetOf();
// Process each association defining children ...
for (Iterator<Association> pathsToChildren = childAssociationList.iterateAssociation(); pathsToChildren.hasNext();) {
Association child = pathsToChildren.next();
String childNavText = getDirectionalLabel(lbscm, scheme, csvt, child, associationsNavigatedFwd);
// Each association may have multiple children ...
AssociatedConceptList branchItemList = child.getAssociatedConcepts();
for (Iterator<AssociatedConcept> branchNodes = branchItemList.iterateAssociatedConcept(); branchNodes
.hasNext();) {
AssociatedConcept branchItemNode = branchNodes.next();
String branchItemCode = branchItemNode.getConceptCode();
// Add here if not in the list of excluded codes.
// This is also where we look to see if another level
// was indicated to be available. If so, mark the
// entry with a '+' to indicate it can be expanded.
if (!codesToExclude.contains(branchItemCode)) {
TreeItem childItem = new TreeItem(branchItemCode, getCodeDescription(branchItemNode));
AssociationList grandchildBranch =
associationsNavigatedFwd
? branchItemNode.getSourceOf()
: branchItemNode.getTargetOf();
if (grandchildBranch != null)
childItem.expandable = true;
ti.addChild(childNavText, childItem);
}
}
}
}
}
示例8: getAssociationTargets
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public HashMap getAssociationTargets(String scheme, String version, String code, String assocName)
{
HashMap hmap = new HashMap();
TreeItem ti = null;
long ms = System.currentTimeMillis();
Util.StopWatch stopWatch = new Util.StopWatch(); //DYEE
Set<String> codesToExclude = Collections.EMPTY_SET;
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
if (version != null) csvt.setVersion(version);
ResolvedConceptReferenceList matches = null;
Vector v = new Vector();
try {
//EVSApplicationService lbSvc = new RemoteServerUtil().createLexBIGService();
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
LexBIGServiceConvenienceMethods lbscm = (LexBIGServiceConvenienceMethods) lbSvc
.getGenericExtension("LexBIGServiceConvenienceMethods");
lbscm.setLexBIGService(lbSvc);
String name = getCodeDescription(lbSvc, scheme, csvt, code);
ti = new TreeItem(code, name);
ti.expandable = false;
CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
ConceptReference focus = Constructors.createConceptReference(code, scheme);
cng = cng.restrictToAssociations(Constructors.createNameAndValueList(assocName), null);
boolean associationsNavigatedFwd = true;
/*
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, true);
*/
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, false);
for (Iterator<ResolvedConceptReference> nodes = branch.iterateResolvedConceptReference(); nodes.hasNext();) {
ResolvedConceptReference node = nodes.next();
AssociationList childAssociationList = associationsNavigatedFwd ? node.getSourceOf() : node.getTargetOf();
// Process each association defining children ...
for (Iterator<Association> pathsToChildren = childAssociationList.iterateAssociation(); pathsToChildren.hasNext();) {
Association child = pathsToChildren.next();
String childNavText = getDirectionalLabel(lbscm, scheme, csvt, child, associationsNavigatedFwd);
// Each association may have multiple children ...
AssociatedConceptList branchItemList = child.getAssociatedConcepts();
for (Iterator<AssociatedConcept> branchNodes = branchItemList.iterateAssociatedConcept(); branchNodes
.hasNext();) {
AssociatedConcept branchItemNode = branchNodes.next();
String branchItemCode = branchItemNode.getConceptCode();
// Add here if not in the list of excluded codes.
// This is also where we look to see if another level
// was indicated to be available. If so, mark the
// entry with a '+' to indicate it can be expanded.
if (!codesToExclude.contains(branchItemCode)) {
TreeItem childItem = new TreeItem(branchItemCode, getCodeDescription(branchItemNode));
ti.expandable = true;
AssociationList grandchildBranch =
associationsNavigatedFwd
? branchItemNode.getSourceOf()
: branchItemNode.getTargetOf();
if (grandchildBranch != null)
childItem.expandable = true;
ti.addChild(childNavText, childItem);
}
}
}
}
hmap.put(code, ti);
} catch (Exception ex) {
ex.printStackTrace();
}
_logger.debug("Run time (milliseconds) getSubconcepts: " + (System.currentTimeMillis() - ms) + " to resolve " );
_logger.debug("DYEE: getSubconcepts: " + stopWatch.getResult() + " to resolve " );
return hmap;
}
示例9: printTo
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Display relations from the given code to other concepts.
* @param code
* @param lbSvc
* @param scheme
* @param csvt
* @throws LBException
*/
@SuppressWarnings("unchecked")
//protected void printTo(String code, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
protected void printTo(String code, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException {
Util.displayMessage("Points to ...");
// Perform the query ...
/*
ResolvedConceptReferenceList matches =
lbSvc.getNodeGraph(scheme, csvt, null)
.resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme),
true, false, 1, 1, new LocalNameList(), null, null, 1024);
*/
CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
ResolvedConceptReferenceList matches =
cng.resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme),
true, false, 1, 1, new LocalNameList(), null, null, 1024);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
Enumeration<ResolvedConceptReference> refEnum =
matches .enumerateResolvedConceptReference();
while (refEnum.hasMoreElements()) {
ResolvedConceptReference ref = refEnum.nextElement();
AssociationList sourceof = ref.getSourceOf();
Association[] associations = sourceof.getAssociation();
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
Util.displayMessage("\t" + assoc.getAssociationName());
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
EntityDescription ed = ac.getEntityDescription();
Util.displayMessage(
"\t\t" + ac.getConceptCode() + "/"
+ (ed == null?
"**No Description**":ed.getContent()));
}
}
}
}
}
示例10: printTo
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Display relations to the given code from other concepts.
* @param code
* @param relation
* @param lbSvc
* @param scheme
* @param csvt
* @throws LBException
*/
protected void printTo(String code, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException
{
Util.displayMessage("Points to ...");
// Perform the query ...
/*
ResolvedConceptReferenceList matches =
lbSvc.getNodeGraph(scheme, csvt, null)
.resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme),
true, false, 1, 1, new LocalNameList(), null, null, 1024);
*/
CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
ResolvedConceptReferenceList matches =
cng.resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme),
true, false, 1, 1, new LocalNameList(), null, null, 1024);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
ResolvedConceptReference ref =
(ResolvedConceptReference) matches.enumerateResolvedConceptReference().nextElement();
// Print the associations
AssociationList sourceof = ref.getSourceOf();
Association[] associations = sourceof.getAssociation();
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
EntityDescription ed = ac.getEntityDescription();
Util.displayMessage(
"\t\t" + ac.getConceptCode() + "/"
+ (ed == null?
"**No Description**":ed.getContent()));
}
}
}
}
示例11: printConcepts
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
protected void printConcepts(String code, ResolvedConceptReferenceList list,
boolean isTargetList) throws LBException {
StringBuffer buffer = new StringBuffer();
if (isTargetList)
buffer.append("* Pointed at by ...\n");
else buffer.append("* Pointed to ...\n");
if (list.getResolvedConceptReferenceCount() <= 0) {
buffer.append(INDENT + "* " + code + ": 0 results.");
Util.displayMessage(buffer.toString());
return;
}
ResolvedConceptReference concept = (ResolvedConceptReference)
list.enumerateResolvedConceptReference().nextElement();
AssociationList aList = isTargetList ? concept.getTargetOf() : concept.getSourceOf();
Association[] associations = aList.getAssociation();
int ctr = 0;
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
String childCode = ac.getConceptCode();
EntityDescription ed = ac.getEntityDescription();
String content = ed == null? "** No Description **" : ed.getContent();
String msg = INDENT + (++ctr) + ") " + childCode + ": " + content;
int childCount = numOfChildren(childCode);
msg += "; children: " + childCount;
if (_displayConcepts)
buffer.append(msg + "\n");
}
}
String parentCode = concept.getConceptCode();
EntityDescription desc = concept.getEntityDescription();
if (desc != null)
buffer.append(INDENT + "* Concept name: " + desc.getContent() + "\n");
buffer.append(INDENT + "* " + parentCode + " (children=" + ctr + ")");
Util.displayMessage(buffer.toString());
}
示例12: addChildren
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Populate child nodes for a single branch of the tree,
* and indicates whether further expansion (to grandchildren)
* is possible.
*/
protected void addChildren(TreeItem ti,
LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm,
String scheme, CodingSchemeVersionOrTag csvt,
String branchRootCode, Set<String> codesToExclude, String[] associationsToNavigate,
boolean associationsNavigatedFwd)
throws LBException {
// Resolve the next branch, representing children of the given
// code, navigated according to the provided relationship and
// direction. Resolve the children as a code graph, looking 2
// levels deep but leaving the final level unresolved.
CodedNodeGraph cng = lbsvc.getNodeGraph(scheme, csvt, null);
ConceptReference focus = Constructors.createConceptReference(branchRootCode, scheme);
cng = cng.restrictToAssociations(Constructors.createNameAndValueList(associationsToNavigate), null);
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, true);
// The resolved branch will be represented by the first node in
// the resolved list. The node will be subdivided by source or
// target associations (depending on direction). The associated
// nodes define the children.
for (Iterator<ResolvedConceptReference> nodes = branch.iterateResolvedConceptReference(); nodes.hasNext();) {
ResolvedConceptReference node = nodes.next();
AssociationList childAssociationList = associationsNavigatedFwd ? node.getSourceOf() : node.getTargetOf();
// Process each association defining children ...
for (Iterator<Association> pathsToChildren = childAssociationList.iterateAssociation(); pathsToChildren.hasNext();) {
Association child = pathsToChildren.next();
String childNavText = getDirectionalLabel(lbscm, scheme, csvt, child, associationsNavigatedFwd);
// Each association may have multiple children ...
AssociatedConceptList branchItemList = child.getAssociatedConcepts();
for (Iterator<AssociatedConcept> branchNodes = branchItemList.iterateAssociatedConcept(); branchNodes
.hasNext();) {
AssociatedConcept branchItemNode = branchNodes.next();
String branchItemCode = branchItemNode.getConceptCode();
// Add here if not in the list of excluded codes.
// This is also where we look to see if another level
// was indicated to be available. If so, mark the
// entry with a '+' to indicate it can be expanded.
if (!codesToExclude.contains(branchItemCode)) {
TreeItem childItem = new TreeItem(branchItemCode, getCodeDescription(branchItemNode));
AssociationList grandchildBranch =
associationsNavigatedFwd
? branchItemNode.getSourceOf()
: branchItemNode.getTargetOf();
if (grandchildBranch != null)
childItem.expandable = true;
ti.addChild(childNavText, childItem);
}
}
}
}
}
示例13: printTo
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Display relations to the given code from other concepts.
* @param code
* @param relation
* @param lbSvc
* @param scheme
* @param csvt
* @throws LBException
*/
protected void printTo(String code, String relation, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException
{
Util.displayMessage("Points to ...");
// Perform the query ...
NameAndValue nv = new NameAndValue();
NameAndValueList nvList = new NameAndValueList();
nv.setName(relation);
nvList.addNameAndValue(nv);
/*
ResolvedConceptReferenceList matches =
lbSvc.getNodeGraph(scheme, csvt, null)
.restrictToAssociations(nvList, null)
.resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme),
true, false, 1, 1, new LocalNameList(), null, null, 1024);
*/
CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
cng = cng.restrictToAssociations(nvList, null);
ResolvedConceptReferenceList matches =
cng.resolveAsList(
ConvenienceMethods.createConceptReference(code, scheme),
true, false, 1, 1, new LocalNameList(), null, null, 1024);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
ResolvedConceptReference ref =
(ResolvedConceptReference) matches.enumerateResolvedConceptReference().nextElement();
// Print the associations
AssociationList sourceof = ref.getSourceOf();
Association[] associations = sourceof.getAssociation();
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
EntityDescription ed = ac.getEntityDescription();
Util.displayMessage(
"\t\t" + ac.getConceptCode() + "/"
+ (ed == null?
"**No Description**":ed.getContent()));
}
}
}
}
示例14: profileAssociations
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* @param lbs - service context
* @param lbscm - convenience methods
* @param csVorT - coding scheme version or tag (version in this case)
* @throws LBException
*/
protected void profileAssociations(LexBIGService lbs, LexBIGServiceConvenienceMethods lbscm, String schemeName, CodingSchemeVersionOrTag csVorT) throws LBException {
// Init frequency for supported properties and qualifiers. This way
// we will know if property or qualifier was registered but not used.
CodingScheme scheme = lbs.resolveCodingScheme(schemeName, csVorT);
Set<String> assocNames = new TreeSet<String>();
for (SupportedAssociation supported : scheme.getMappings().getSupportedAssociation()) {
assocNames.add(supported.getLocalId());
assoc2srcFreq.put(supported.getLocalId(), 0);
assoc2tgtFreq.put(supported.getLocalId(), 0);
}
// For each association, determine frequencies ...
int count = 0;
try {
// Resolve and evaluate all source to target relationships.
// Since this step can be extensive provide periodic feedback to the user
// to indicate the process is still active ...
CodedNodeSet allCodes = lbs.getCodingSchemeConcepts(schemeName, csVorT);
LocalNameList noProps = Constructors.createLocalNameList("--no-property--");
ResolvedConceptReferencesIterator potentialSources =
allCodes.resolve(null, noProps, null);
// Brute force approach to evaluate each possible source, concept by concept.
// Time intensive, but scales better and helps avoid possible bottlenecks related
// to exceeding system-defined search limits.
while (potentialSources.hasNext()) {
ResolvedConceptReference potentialSource = potentialSources.next();
CodedNodeGraph cng = lbs.getNodeGraph(schemeName, csVorT, null);
ResolvedConceptReferenceList rcrList =
cng.resolveAsList(potentialSource, true, false, -1, 1, noProps, null, null, null, -1);
for (ResolvedConceptReference rcr : rcrList.getResolvedConceptReference()) {
AssociationList assocList = rcr.getSourceOf();
for (Association assoc : assocList.getAssociation()) {
// Bump source count ...
String assocName = assoc.getAssociationName();
Integer freq = assoc2srcFreq.get(assocName);
assoc2srcFreq.put(assocName, (freq == null ? 1 : freq + 1));
// Bump target count ...
freq = assoc2tgtFreq.get(assocName);
int targetCount = assoc.getAssociatedConcepts().getAssociatedConceptCount();
assoc2tgtFreq.put(assocName, (freq == null ? targetCount : freq + targetCount));
}
if (count++ % 100 == 0) System.out.print('.');
if (count % 7800 == 0) System.out.println();
}
}
} catch (Exception e) {
Util.displayMessage(e.getMessage());
}
}
示例15: transformSummaryDescription
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
@Override
public List<AssociationDirectoryEntry> transformSummaryDescription(
ResolvedConceptReferenceAssociationPage ref) {
ResolvedConceptReference subject = ref.getResolvedConceptReference();
List<AssociationDirectoryEntry> returnList = new ArrayList<AssociationDirectoryEntry>();
URIAndEntityName uriEntityName = new URIAndEntityName();
uriEntityName.setName(subject.getCode());
uriEntityName.setNamespace(this.sanitizeNamespace(subject.getCodeNamespace()));
uriEntityName.setUri(this.getUriHandler().getEntityUri(subject));
uriEntityName.setHref(this.getTransformUtils().createEntityHref(subject));
AssociationList associations;
switch(ref.getDirection()){
case SOURCEOF:{
associations = subject.getSourceOf();
break;
}
case TARGETOF: {
associations = subject.getTargetOf();
break;
}
default : throw new IllegalStateException();
}
int counter = 0;
if(associations != null){
for (Association association : associations.getAssociation()) {
//We can reuse these in each entry
PredicateReference predReference = new PredicateReference();
predReference.setName(association.getAssociationName());
predReference.setUri(
this.getUriHandler().
getPredicateUri(
subject.getCodingSchemeURI(),
subject.getCodingSchemeVersion(),
association.getAssociationName()));
CodeSystemVersionReference codeSystemVersionReference = this.getTransformUtils().toCodeSystemVersionReference(
this.getCodingSchemeNameTranslator().translateFromLexGrid(subject.getCodingSchemeName()),
subject.getCodingSchemeVersion(),
subject.getCodingSchemeURI());
for (AssociatedConcept target : association.getAssociatedConcepts()
.getAssociatedConcept()) {
if(counter++ >= ref.getStart()){
AssociationDirectoryEntry entry = new AssociationDirectoryEntry();
entry.setSubject(uriEntityName);
entry.setAssertedBy(codeSystemVersionReference);
entry.setPredicate(predReference);
StatementTarget st = new StatementTarget();
uriEntityName = new URIAndEntityName();
uriEntityName.setName(target.getCode());
uriEntityName.setNamespace(this.sanitizeNamespace(target.getCodeNamespace()));
uriEntityName.setUri(this.getUriHandler().getEntityUri(target));
uriEntityName.setHref(this.getTransformUtils().createEntityHref(target));
st.setEntity(uriEntityName);
entry.setTarget(st);
returnList.add(entry);
if(returnList.size() == ref.getEnd()){
return returnList;
}
}
}
}
}
return returnList;
}