本文整理汇总了Java中org.LexGrid.concepts.Presentation类的典型用法代码示例。如果您正苦于以下问题:Java Presentation类的具体用法?Java Presentation怎么用?Java Presentation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Presentation类属于org.LexGrid.concepts包,在下文中一共展示了Presentation类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPresentationProperties
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public Vector getPresentationProperties(Entity concept) {
Vector v = new Vector();
org.LexGrid.commonTypes.Property[] properties =
concept.getPresentation();
// name$value$isPreferred
if (properties == null || properties.length == 0)
return v;
for (int i = 0; i < properties.length; i++) {
Presentation p = (Presentation) properties[i];
String name = p.getPropertyName();
String value = p.getValue().getContent();
String isPreferred = "false";
if (p.getIsPreferred() != null) {
isPreferred = p.getIsPreferred().toString();
}
String t = name + "$" + value + "$" + isPreferred;
v.add(t);
}
return v;
}
示例2: getPresentationProperties
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public Vector getPresentationProperties(Entity concept) {
Vector v = new Vector();
org.LexGrid.commonTypes.Property[] properties =
concept.getPresentation();
// name$value$isPreferred
if (properties == null || properties.length == 0)
return v;
for (int i = 0; i < properties.length; i++) {
Presentation p = (Presentation) properties[i];
String name = p.getPropertyName();
String value = p.getValue().getContent();
String isPreferred = "false";
if (p.getIsPreferred() != null) {
isPreferred = p.getIsPreferred().toString();
}
String t = name + "$" + value + "$" + isPreferred;
v.add(t);
}
return SortUtils.quickSort(v);
}
示例3: getItemText
import org.LexGrid.concepts.Presentation; //导入依赖的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();
}
示例4: dumpProperty
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public void dumpProperty(Property property) {
System.out.println("\n" + property.getPropertyType());
System.out.println(property.getPropertyName() + ": " + property.getValue().getContent());
PropertyQualifier[] qualifiers = property.getPropertyQualifier();
if (qualifiers != null) {
System.out.println("Property Qualifiers: " );
for (int i=0; i<qualifiers.length; i++) {
PropertyQualifier qualifier = qualifiers[i];
System.out.println("\t" + qualifier.getPropertyQualifierName() + ": " + qualifier.getValue().getContent());
}
}
Source[] sources = property.getSource();
if (sources != null) {
System.out.println("Sources: " );
for (int i=0; i<sources.length; i++) {
Source source = sources[i];
System.out.println("\t" + source.getContent());
}
}
if (property instanceof Presentation) {
Presentation presentation = (Presentation) property;
if (presentation.getRepresentationalForm() != null) {
System.out.println("RepresentationalForm: " + presentation.getRepresentationalForm());
}
}
}
示例5: getPreferredName
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public String getPreferredName(Entity c) {
Presentation[] presentations = c.getPresentation();
for (int i = 0; i < presentations.length; i++) {
Presentation p = presentations[i];
if (p.getPropertyName().compareTo("Preferred_Name") == 0) {
return p.getValue().getContent();
}
}
return null;
}
示例6: sortByScore
import org.LexGrid.concepts.Presentation; //导入依赖的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: toDesignation
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
protected List<Designation> toDesignation(Presentation... presentations){
List<Designation> returnList = new ArrayList<Designation>();
for(Presentation presentation : presentations){
Designation designation = new Designation();
DesignationRole role;
if(BooleanUtils.toBoolean(presentation.isIsPreferred())){
role = DesignationRole.PREFERRED;
} else {
role = DesignationRole.ALTERNATIVE;
}
designation.setValue(
ModelUtils.toTsAnyType(presentation.getValue().getContent()));
designation.setDesignationRole(role);
LanguageReference lref = new LanguageReference();
lref.setContent(presentation.getLanguage());
designation.setLanguage(lref);
if(presentation.getSource().length > 0){
designation.setAssertedInCodeSystemVersion(presentation.getSource()[0].getContent());
}
returnList.add(designation);
}
return returnList;
}
示例8: createStringFromPresentationsInEntityObject
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public static String createStringFromPresentationsInEntityObject(Entity entity, int tabCount){
Presentation presentation;
StringBuffer results = new StringBuffer();
String tabs = createTabs(tabCount);
int count = entity.getPresentationCount();
for(int i=0; i < count; i++){
presentation = entity.getPresentation(i);
appendLine(results, tabs, "Value = " + presentation.getValue().getContent());
appendLine(results, tabs, "--DegreeOfFidelity = " + presentation.getDegreeOfFidelity());
appendLine(results, tabs, "--Language = " + presentation.getLanguage());
appendLine(results, tabs, "--Owner = " + presentation.getOwner());
appendLine(results, tabs, "--PropertyID = " + presentation.getPropertyId());
appendLine(results, tabs, "--PropertyName = " + presentation.getPropertyName());
appendLine(results, tabs, "--PropertyType = " + presentation.getPropertyType());
appendLine(results, tabs, "--RepresentationalForm = " + presentation.getRepresentationalForm());
appendLine(results, tabs, "--Status = " + presentation.getStatus());
appendLine(results, tabs, "--SourceCount = " + presentation.getSourceCount());
appendLine(results, tabs, "--Sources:\n");
appendLine(results, "", createStringFromSourceInPresentationObject(presentation, tabCount + 1));
appendLine(results, tabs, "--PropertyQualifierCount = " + presentation.getPropertyQualifierCount());
appendLine(results, tabs, "--PropertyQualifiers:\n");
appendLine(results, "", createStringFromPropertyQualifiersInPresentationObject(presentation, tabCount + 1));
appendLine(results, tabs, "--UsageContextCount = " + presentation.getUsageContextCount());
appendLine(results, tabs, "--UsageContexts:\n");
appendLine(results, "", createStringFromUsageContextsInPresentationObject(presentation, tabCount + 1));
}
return results.toString();
}
示例9: createStringFromSourceInPresentationObject
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public static String createStringFromSourceInPresentationObject(Presentation presentation, int tabCount){
StringBuffer results = new StringBuffer();
String tabs = createTabs(tabCount);
int count = presentation.getSourceCount();
for(int i=0; i < count; i++){
appendLine(results, tabs, " " + presentation.getSource(i).getContent());
}
return results.toString();
}
示例10: createStringFromPropertyQualifiersInPresentationObject
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public static String createStringFromPropertyQualifiersInPresentationObject(Presentation presentation, int tabCount){
StringBuffer results = new StringBuffer();
String tabs = createTabs(tabCount);
int count = presentation.getPropertyQualifierCount();
for(int i=0; i < count; i++){
appendLine(results, tabs, " " + presentation.getPropertyQualifier(i));
}
return results.toString();
}
示例11: createStringFromUsageContextsInPresentationObject
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public static String createStringFromUsageContextsInPresentationObject(Presentation presentation, int tabCount){
StringBuffer results = new StringBuffer();
String tabs = createTabs(tabCount);
int count = presentation.getUsageContextCount();
for(int i=0; i < count; i++){
appendLine(results, tabs, " " + presentation.getUsageContext(i));
}
return results.toString();
}
示例12: getSynonyms
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public Vector getSynonyms(String scheme, Entity concept) {
if (concept == null)
return null;
Vector v = new Vector();
Presentation[] properties = concept.getPresentation();
int n = 0;
boolean inclusion = true;
for (int i = 0; i < properties.length; i++) {
Presentation p = properties[i];
// for NCI Thesaurus or Pre-NCI Thesaurus, show FULL_SYNs only
if (scheme != null && (scheme.indexOf("NCI_Thesaurus") != -1 || scheme.indexOf("NCI Thesaurus") != -1)) {
inclusion = false;
if (p.getPropertyName().compareTo("FULL_SYN") == 0) {
inclusion = true;
}
}
if (inclusion) {
String term_name = p.getValue().getContent();
String term_type = "null";
String term_source = "null";
String term_source_code = "null";
String term_subsource = "null";
PropertyQualifier[] qualifiers = p.getPropertyQualifier();
if (qualifiers != null) {
for (int j = 0; j < qualifiers.length; j++) {
PropertyQualifier q = qualifiers[j];
String qualifier_name = q.getPropertyQualifierName();
String qualifier_value = q.getValue().getContent();
if (qualifier_name.compareTo("source-code") == 0) {
term_source_code = qualifier_value;
}
if (qualifier_name.compareTo("subsource-name") == 0) {
term_subsource = qualifier_value;
}
}
}
term_type = p.getRepresentationalForm();
Source[] sources = p.getSource();
if (sources != null && sources.length > 0) {
Source src = sources[0];
term_source = src.getContent();
}
v.add(term_name + "|" + term_type + "|" + term_source + "|"
+ term_source_code + "|" + term_subsource);
}
}
SortUtils.quickSort(v);
return v;
}
示例13: getAllSynonyms
import org.LexGrid.concepts.Presentation; //导入依赖的package包/类
public Vector getAllSynonyms(String scheme, Entity concept) {
if (concept == null)
return null;
Vector v = new Vector();
Presentation[] properties = concept.getPresentation();
int n = 0;
boolean inclusion = true;
for (int i = 0; i < properties.length; i++) {
Presentation p = properties[i];
String term_name = p.getValue().getContent();
String term_type = "null";
String term_source = "null";
String term_source_code = "null";
String term_subsource = "null";
PropertyQualifier[] qualifiers = p.getPropertyQualifier();
if (qualifiers != null) {
for (int j = 0; j < qualifiers.length; j++) {
PropertyQualifier q = qualifiers[j];
String qualifier_name = q.getPropertyQualifierName();
String qualifier_value = q.getValue().getContent();
if (qualifier_name.compareTo("source-code") == 0) {
term_source_code = qualifier_value;
}
if (qualifier_name.compareTo("subsource-name") == 0) {
term_subsource = qualifier_value;
}
}
}
term_type = p.getRepresentationalForm();
Source[] sources = p.getSource();
if (sources != null && sources.length > 0) {
Source src = sources[0];
term_source = src.getContent();
}
v.add(term_name + "|" + term_type + "|" + term_source + "|"
+ term_source_code + "|" + term_subsource);
}
SortUtils.quickSort(v);
return v;
}
示例14: printContext
import org.LexGrid.concepts.Presentation; //导入依赖的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;
}
}