本文整理汇总了Java中org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference.getReferencedEntry方法的典型用法代码示例。如果您正苦于以下问题:Java ResolvedConceptReference.getReferencedEntry方法的具体用法?Java ResolvedConceptReference.getReferencedEntry怎么用?Java ResolvedConceptReference.getReferencedEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference
的用法示例。
在下文中一共展示了ResolvedConceptReference.getReferencedEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemText
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Returns the text representing the given item. Note that in
* general this method assumes the presentations have been constrianed
* during the initial query by HCD qualification.
* @param rcr Concept resolved from a query.
* @param hcd The hierarchical code to reflect in printed output.
* @return The first embedded text presentation, or the item
* description if no presentation is found.
*/
protected String getItemText(ResolvedConceptReference rcr, String hcd) {
StringBuffer sb = new StringBuffer(rcr.getConceptCode());
boolean presFound = false;
if (rcr.getReferencedEntry() != null) {
Presentation[] presentations = rcr.getReferencedEntry().getPresentation();
for (int i = 0; i < presentations.length && !presFound; i++) {
Presentation p = presentations[i];
PropertyQualifier[] quals = p.getPropertyQualifier();
for (int j = 0; j < quals.length && !presFound; j++) {
PropertyQualifier pq = quals[j];
if (presFound = "HCD".equals(pq.getPropertyQualifierId()) && hcd.equals(pq.getContent())) {
sb.append(':').append(p.getText().getContent());
}
}
}
}
if (!presFound && rcr.getEntityDescription() != null)
sb.append(':').append(rcr.getEntityDescription().getContent());
return sb.toString();
}
示例2: printText
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Print code and text for all text presentations associated
* with the given concept reference. If specified, the given words
* are compared against each printed presentation according to the
* chosen match option. Match option of 1 indicates to match at
* least one word; match option of 2 indicates a presentation
* must match all words.
* @param ref
* @param matchWords
* @param matchOption
*/
protected int printText(int ctr, ResolvedConceptReference ref, String[] matchWords, int matchOption) {
// Identify the unique set of text presentations;
// avoid duplicate registration by multiple sources, etc ...
Concept concept = ref.getReferencedEntry();
Set<String> presentations = new HashSet<String>();
for (int j = 0; j < concept.getPresentationCount(); j++)
presentations.add(concept.getPresentation(j).getText().getContent());
// Print matching results
String code = "[" + ref.getConceptCode() + ']';
for (Iterator<String> strings = presentations.iterator(); strings.hasNext(); ) {
String term = strings.next();
final List<String> words = Arrays.asList(matchWords);
float weight = getTextWeight(term, words);
if (matchOption == 1 && weight > 0 || matchOption == 2 && weight == 1)
if (_displayConcepts)
_buffer.append(INDENT + (++ctr) + ") " + code + term + "\n");
}
return ctr;
}
示例3: printText
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Print code and text for all text presentations associated
* with the given concept reference. If specified, any printed terms
* will have stop words removed prior to comparison, must include
* the given prefix, and can be constrained to those with a set
* number of words.
* @param ref
* @param removeStopWords
* @param prefix
* @param wordCount
*/
protected void printText(ResolvedConceptReference ref, boolean removeStopWords, String prefix, int wordCount) {
// Identify the unique set of text presentations;
// avoid duplicate registration by multiple sources, etc ...
Concept concept = ref.getReferencedEntry();
Set<String> presentations = new HashSet<String>();
for (int j = 0; j < concept.getPresentationCount(); j++)
presentations.add(concept.getPresentation(j).getText().getContent());
// Print the result
String code = "\t[" + ref.getConceptCode() + ']';
for (Iterator<String> strings = presentations.iterator(); strings.hasNext(); ) {
String term = strings.next();
if ((prefix == null || term.toLowerCase().startsWith(prefix))
&& (wordCount < 0 || toWords(term, removeStopWords).length == wordCount))
Util.displayMessage(code + term);
}
}
示例4: resolveIterator
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Resolve the Iterator
*
* @param iterator
* @param maxToReturn
* @param code
* @return
*/
public Vector<Entity> resolveIterator(
ResolvedConceptReferencesIterator iterator, int maxToReturn,
String code) {
Vector<Entity> v = new Vector<Entity>();
if (iterator == null) {
_logger.warn("No match.");
return v;
}
try {
int iteration = 0;
while (iterator.hasNext()) {
iteration++;
iterator = iterator.scroll(maxToReturn);
ResolvedConceptReferenceList rcrl = iterator.getNext();
ResolvedConceptReference[] rcra = rcrl
.getResolvedConceptReference();
for (int i = 0; i < rcra.length; i++) {
ResolvedConceptReference rcr = rcra[i];
Entity ce = rcr.getReferencedEntry();
if (code == null) {
v.add(ce);
} else {
if (ce.getEntityCode().compareTo(code) != 0)
v.add(ce);
}
}
}
} catch (Exception e) {
_logger.warn(e.getMessage());
}
return v;
}
示例5: getConceptDomainNames
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public Vector getConceptDomainNames() {
String scheme = "conceptDomainCodingScheme";
String version = null;
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
Vector conceptDomainName_vec = new Vector();
try {
LocalNameList entityTypes = new LocalNameList();
entityTypes.addEntry("conceptDomain");
CodedNodeSet cns = lbSvc.getNodeSet(scheme, csvt, entityTypes);
SortOptionList sortOptions = null;
LocalNameList filterOptions = null;
LocalNameList propertyNames = null;
CodedNodeSet.PropertyType[] propertyTypes = null;
boolean resolveObjects = true;
int maxToReturn = 1000;
ResolvedConceptReferenceList rcrl = cns.resolveToList(sortOptions, filterOptions, propertyNames, propertyTypes, resolveObjects, maxToReturn);
for (int i=0; i<rcrl.getResolvedConceptReferenceCount(); i++) {
ResolvedConceptReference rcr = rcrl.getResolvedConceptReference(i);
Entity entity = rcr.getReferencedEntry();
if (entity.getEntityDescription() != null) {
conceptDomainName_vec.add(entity.getEntityDescription().getContent());
} else {
conceptDomainName_vec.add("");
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
conceptDomainName_vec = SortUtils.quickSort(conceptDomainName_vec);
return conceptDomainName_vec;
}
示例6: sortByScore
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Sorts the given concept references based on a scoring algorithm
* designed to provide a more natural ordering. Scores are determined by
* comparing each reference against a provided search term.
* @param searchTerm The term used for comparison; single or multi-word.
* @param toSort The iterator containing references to sort.
* @param maxToReturn Sets upper limit for number of top-scored items returned.
* @return Iterator over sorted references.
* @throws LBException
*/
protected ResolvedConceptReferencesIterator sortByScore(String searchTerm, ResolvedConceptReferencesIterator toSort, int maxToReturn) throws LBException {
//logger.debug("Sorting by score: " + searchTerm);
// Determine the set of individual words to compare against.
List<String> compareWords = toScoreWords(searchTerm);
// Create a bucket to store results.
Map<String, ScoredTerm> scoredResult = new TreeMap<String, ScoredTerm>();
// Score all items ...
while (toSort.hasNext()) {
// Working in chunks of 100.
ResolvedConceptReferenceList refs = toSort.next(100);
for (int i = 0; i < refs.getResolvedConceptReferenceCount(); i++) {
ResolvedConceptReference ref = refs.getResolvedConceptReference(i);
String code = ref.getConceptCode();
Concept ce = ref.getReferencedEntry();
// Note: Preferred descriptions carry more weight,
// but we process all terms to allow the score to improve
// based on any contained presentation.
Presentation[] allTermsForConcept = ce.getPresentation();
for (Presentation p : allTermsForConcept) {
float score = score(p.getText().getContent(), compareWords, p.isIsPreferred(), i);
// Check for a previous match on this code for a different presentation.
// If already present, keep the highest score.
if (scoredResult.containsKey(code)) {
ScoredTerm scoredTerm = (ScoredTerm) scoredResult.get(code);
if (scoredTerm.score > score)
continue;
}
scoredResult.put(code, new ScoredTerm(ref, score));
}
}
}
// Return an iterator that will sort the scored result.
return new ScoredIterator(scoredResult.values(), maxToReturn);
}
示例7: resolveIterator
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public static Vector resolveIterator(ResolvedConceptReferencesIterator iterator, int maxToReturn, String code)
{
Vector v = new Vector();
if (iterator == null)
{
_logger.debug("No match.");
return v;
}
try {
int iteration = 0;
while (iterator.hasNext())
{
iteration++;
iterator = iterator.scroll(maxToReturn);
ResolvedConceptReferenceList rcrl = iterator.getNext();
ResolvedConceptReference[] rcra = rcrl.getResolvedConceptReference();
for (int i=0; i<rcra.length; i++)
{
ResolvedConceptReference rcr = rcra[i];
org.LexGrid.concepts.Concept ce = rcr.getReferencedEntry();
//_logger.debug("Iteration " + iteration + " " + ce.getId() + " " + ce.getEntityDescription().getContent());
if (code == null)
{
v.add(ce);
}
else
{
if (ce.getId().compareTo(code) != 0) v.add(ce);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return v;
}
示例8: getReferenceWeight
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Return a relative weight between 0 and 1 that indicates how well the
* given reference maps to a set of words.
* @param ref
* @param matchWords
* @return
*/
protected float getReferenceWeight(ResolvedConceptReference ref, List<String> matchWords) {
float weight = 0;
Concept ce = ref.getReferencedEntry();
int presCount = ce.getPresentationCount();
for (int i = 0; i < presCount; i++) {
weight = Math.max(weight, getTextWeight(ce.getPresentation(i).getText().getContent(), matchWords));
}
return weight;
}
示例9: getReferenceWeight
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Return a relative weight between 0 and 1 that indicates how well the
* given reference maps to a set of words.
* @param ref
* @param matchWords
* @return
*/
protected float getReferenceWeight(ResolvedConceptReference ref, List<String> matchWords) {
float weight = 0;
Concept ce = ref.getReferencedEntry();
int presCount = ce.getPresentationCount();
for (int i = 0; i < presCount; i++) {
weight = Math.max(weight, getTextWeight(ce.getPresentation(i).getText().getContent(), matchWords));
}
return weight;
}
示例10: getConceptWithProperty
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public Entity getConceptWithProperty(String scheme, String version,
String code, String propertyName) {
try {
CodingSchemeVersionOrTag versionOrTag =
new CodingSchemeVersionOrTag();
if (version != null) versionOrTag.setVersion(version);
ConceptReferenceList crefs =
createConceptReferenceList(new String[] { code }, scheme);
CodedNodeSet cns = null;
try {
cns = lbSvc.getCodingSchemeConcepts(scheme, versionOrTag);
} catch (Exception e1) {
e1.printStackTrace();
return null;
}
//cns = cns.restrictToCodes(crefs);
try {
cns = cns.restrictToCodes(crefs);
LocalNameList propertyNames = new LocalNameList();
if (propertyName != null) propertyNames.addEntry(propertyName);
CodedNodeSet.PropertyType[] propertyTypes = null;
//long ms = System.currentTimeMillis(), delay = 0;
SortOptionList sortOptions = null;
LocalNameList filterOptions = null;
boolean resolveObjects = true; // needs to be set to true
int maxToReturn = 1000;
ResolvedConceptReferenceList rcrl =
cns.resolveToList(sortOptions, filterOptions,
propertyNames, propertyTypes, resolveObjects,
maxToReturn);
//HashMap hmap = new HashMap();
if (rcrl == null) {
////_logger.warn("Concep not found.");
return null;
}
if (rcrl.getResolvedConceptReferenceCount() > 0) {
// ResolvedConceptReference[] list =
// rcrl.getResolvedConceptReference();
for (int i = 0; i < rcrl.getResolvedConceptReferenceCount(); i++) {
ResolvedConceptReference rcr =
rcrl.getResolvedConceptReference(i);
Entity c = rcr.getReferencedEntry();
return c;
}
}
return null;
} catch (Exception e) {
//_logger.error("Method: SearchUtil.getConceptWithProperty");
//_logger.error("* ERROR: getConceptWithProperty throws exceptions.");
//_logger.error("* " + e.getClass().getSimpleName() + ": "
// + e.getMessage());
//e.printStackTrace();
}
} catch (Exception ex) {
//_logger.error("Method: SearchUtil.getConceptWithProperty");
//_logger.error("* ERROR: getConceptWithProperty throws exceptions.");
//_logger.error("* " + ex.getClass().getSimpleName() + ": "
// + ex.getMessage());
}
return null;
}
示例11: getNCIDefinition
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public String getNCIDefinition(ResolvedConceptReference ref) {
if (ref == null) return null;
Entity concept = ref.getReferencedEntry();
if (concept == null) return null;
Definition[] definitions = concept.getDefinition();
Vector v = new Vector();
if (definitions == null) return null;
for (int i=0; i<definitions.length; i++) {
Definition definition = definitions[i];
Source[] sources = definition.getSource();
for (int j=0; j<sources.length; j++)
{
Source src = sources[j];
String src_name = src.getContent();
if (src_name.compareTo("NCI") == 0) {
v.add(definition.getValue().getContent());
}
}
PropertyQualifier[] qualifiers = definition.getPropertyQualifier();
for (int j=0; j<qualifiers.length; j++)
{
String qualifier_value = qualifiers[j].getValue().getContent();
if (qualifier_value.compareTo("NCI") == 0) {
v.add(definition.getValue().getContent());
}
}
}
if (v.size() == 0) return null;
if (v.size() == 1) return (String) v.elementAt(0);
String def_str = "";
for (int i=0; i<v.size(); i++) {
String def = (String) v.elementAt(i);
if (i == 0) {
def_str = def;
} else {
def_str = def_str + "|" + def;
}
}
return def_str;
}
示例12: getConceptWithProperty
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public Entity getConceptWithProperty(String scheme, String version,
String code, String propertyName) {
try {
CodingSchemeVersionOrTag versionOrTag =
new CodingSchemeVersionOrTag();
if (version != null) versionOrTag.setVersion(version);
ConceptReferenceList crefs =
createConceptReferenceList(new String[] { code }, scheme);
CodedNodeSet cns = null;
try {
cns = lbSvc.getCodingSchemeConcepts(scheme, versionOrTag);
} catch (Exception e1) {
e1.printStackTrace();
return null;
}
//cns = cns.restrictToCodes(crefs);
try {
cns = cns.restrictToCodes(crefs);
LocalNameList propertyNames = new LocalNameList();
if (propertyName != null) propertyNames.addEntry(propertyName);
CodedNodeSet.PropertyType[] propertyTypes = null;
//long ms = System.currentTimeMillis(), delay = 0;
SortOptionList sortOptions = null;
LocalNameList filterOptions = null;
boolean resolveObjects = true; // needs to be set to true
int maxToReturn = 1000;
ResolvedConceptReferenceList rcrl =
cns.resolveToList(sortOptions, filterOptions,
propertyNames, propertyTypes, resolveObjects,
maxToReturn);
//HashMap hmap = new HashMap();
if (rcrl == null) {
_logger.warn("Concep not found.");
return null;
}
if (rcrl.getResolvedConceptReferenceCount() > 0) {
// ResolvedConceptReference[] list =
// rcrl.getResolvedConceptReference();
for (int i = 0; i < rcrl.getResolvedConceptReferenceCount(); i++) {
ResolvedConceptReference rcr =
rcrl.getResolvedConceptReference(i);
Entity c = rcr.getReferencedEntry();
return c;
}
}
return null;
} catch (Exception e) {
_logger.error("Method: SearchUtil.getConceptWithProperty");
_logger.error("* ERROR: getConceptWithProperty throws exceptions.");
_logger.error("* " + e.getClass().getSimpleName() + ": "
+ e.getMessage());
//e.printStackTrace();
}
} catch (Exception ex) {
_logger.error("Method: SearchUtil.getConceptWithProperty");
_logger.error("* ERROR: getConceptWithProperty throws exceptions.");
_logger.error("* " + ex.getClass().getSimpleName() + ": "
+ ex.getMessage());
}
return null;
}
示例13: getConceptByCode
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public static Concept getConceptByCode(String codingSchemeName, String vers, String ltag, String code)
{
try {
//LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
LexBIGService lbSvc = AppService.getInstance().getLBSvc();
if (lbSvc == null)
{
_logger.warn("lbSvc == null???");
return null;
}
CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
versionOrTag.setVersion(vers);
ConceptReferenceList crefs =
createConceptReferenceList(
new String[] {code}, codingSchemeName);
CodedNodeSet cns = null;
try {
cns = lbSvc.getCodingSchemeConcepts(codingSchemeName, versionOrTag);
} catch (Exception e1) {
e1.printStackTrace();
}
cns = cns.restrictToCodes(crefs);
ResolvedConceptReferenceList matches = cns.resolveToList(null, null, null, 1);
if (matches == null)
{
_logger.warn("Concep not found.");
return null;
}
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
ResolvedConceptReference ref =
(ResolvedConceptReference) matches.enumerateResolvedConceptReference().nextElement();
Concept entry = ref.getReferencedEntry();
return entry;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
}
示例14: printProps
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Display properties for the given code.
* @param code
* @param lbSvc
* @param scheme
* @param csvt
* @return
* @throws LBException
*/
//protected boolean printProps(String code, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
protected boolean printProps(String code, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException
{
// Perform the query ...
ConceptReferenceList crefs =
ConvenienceMethods
.createConceptReferenceList(new String[] { code }, scheme);
/*
ResolvedConceptReferenceList matches =
lbSvc.getCodingSchemeConcepts(scheme, csvt)
.restrictToStatus(ActiveOption.ALL, null)
.restrictToCodes(crefs).resolveToList(null,null,null, 1);
*/
CodedNodeSet cns = lbSvc.getCodingSchemeConcepts(scheme, csvt);
cns = cns.restrictToStatus(ActiveOption.ALL, null);
cns = cns.restrictToCodes(crefs);
ResolvedConceptReferenceList matches =cns.resolveToList(null,null,null, 1);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
ResolvedConceptReference ref =
(ResolvedConceptReference) matches
.enumerateResolvedConceptReference().nextElement();
Concept entry = ref.getReferencedEntry();
ConceptProperty[] props = entry.getConceptProperty();
for (int i = 0; i < props.length; i++) {
Property prop = props[i];
Util.displayMessage(new StringBuffer()
.append("\tProperty name: ").append(prop.getPropertyName())
.append(" text: ").append(prop.getText().getContent())
.toString());
}
} else {
Util.displayMessage("No match found!");
return false;
}
return true;
}
示例15: printContext
import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
* Recursively display each context that the code participates in with
* additional information.
* @param rcr
* @param lbSvc
* @param scheme
* @param csvt
* @throws LBException
*/
protected void printContext(ResolvedConceptReference rcr, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException
{
Concept ce = rcr.getReferencedEntry();
// Step through the presentations and evaluate any tagged with
// hcd(s) one by one ...
int hcdsFound = 0;
for (int i = 0; i < ce.getPresentationCount(); i++) {
Presentation pres = ce.getPresentation(i);
PropertyQualifier[] quals = pres.getPropertyQualifier();
for (int q = 0; q < quals.length; q++) {
PropertyQualifier qual = quals[q];
if (qual.getPropertyQualifierId().equalsIgnoreCase("HCD")) {
String hcd = qual.getContent();
Util.displayMessage("");
Util.displayMessage("HCD: " + hcd);
hcdsFound++;
// Define a code set for all concepts tagged with the HCD.
CodedNodeSet hcdConceptMatch = lbSvc.getCodingSchemeConcepts(scheme, csvt);
hcdConceptMatch.restrictToProperties(
null, // property names
new PropertyType[] {PropertyType.PRESENTATION}, // property types
null, // source list
null, // context list
ConvenienceMethods.createNameAndValueList("HCD", hcd) // qualifier list
);
// Define a code graph for all relations tagged with the HCD.
CodedNodeGraph hcdGraph = lbSvc.getNodeGraph(scheme, csvt, "UMLS_Relations");
// Now restrict the code graph based on the code set (so, exclude
// nodes that do not contain the desired tag).
CodedNodeGraph hcdTargeted = hcdGraph.restrictToTargetCodes(hcdConceptMatch);
hcdTargeted.restrictToAssociations(
ConvenienceMethods.createNameAndValueList(hierAssocNames_),
ConvenienceMethods.createNameAndValueList("HCD", hcd));
ResolvedConceptReference[] links = hcdTargeted.resolveAsList(
null, // graph focus
true, // resolve forward
false, // resolve backward
Integer.MAX_VALUE, // coded entry depth
-1, // association depth
null, // property names
new PropertyType[] {PropertyType.PRESENTATION}, // property types
null, // sort options
500 // max to return
).getResolvedConceptReference();
// Resolve and print the chain of terms ...
for (int j = 0; j < links.length; j++) {
ResolvedConceptReference link = links[j];
StringBuffer sb = new StringBuffer(getItemText(link, hcd));
printAssociationList(sb, hcd, link.getSourceOf(), 0, true);
printAssociationList(sb, hcd, link.getTargetOf(), 0, false);
Util.displayMessage(sb.toString());
}
}
}
}
if (hcdsFound == 0) {
Util.displayMessage("No hierarchical tags (HCD properties) found.");
return;
}
}