当前位置: 首页>>代码示例>>Java>>正文


Java ResolvedConceptReference.getConceptCode方法代码示例

本文整理汇总了Java中org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference.getConceptCode方法的典型用法代码示例。如果您正苦于以下问题:Java ResolvedConceptReference.getConceptCode方法的具体用法?Java ResolvedConceptReference.getConceptCode怎么用?Java ResolvedConceptReference.getConceptCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference的用法示例。


在下文中一共展示了ResolvedConceptReference.getConceptCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateSourceViewInHierarchyTests

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public void generateSourceViewInHierarchyTests(int number) {
 String scheme = gov.nih.nci.evs.browser.common.Constants.NCI_METATHESAURUS;
 String version = NCIm_PROD_Version;
 ResolvedConceptReferenceList rcrl = testUtils.generateTestCases(scheme, version, 10, number);
 int n = rvGenerator.uniform(0, rcrl.getResolvedConceptReferenceCount()-1);
 ResolvedConceptReference rcr = (ResolvedConceptReference) rcrl.getResolvedConceptReference(n);
 String code = rcr.getConceptCode();
 String name = rcr.getEntityDescription().getContent();

 // code search
 test_counter++;
 int testNumber = test_counter;
 String browserLink = null;
 String algorithm = "exactMatch";
 String matchText = code;
 String target = "codes";

 TestCase testCase = testCaseWriter.createTestCase(testNumber, TestCase.VIEW_IN_HIERARCHY,
								  browserLink,
								  scheme, version, algorithm, target, matchText);
 testCaseWriter.writeTestCase(testCase);
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:23,代码来源:NCImUITestGenerator.java

示例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 void printText(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 = "\t[" + 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)
			Util.displayMessage(code + term);
	}
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:30,代码来源:MetaMatch.java

示例3: 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);
	}
}
 
开发者ID:NCIP,项目名称:camod,代码行数:25,代码来源:PrintUtility.java

示例4: 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 int printText(int ctr, 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 = "[" + 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))
            if (_displayConcepts)
                _buffer.append(INDENT + (++ctr) + ") " + code + term + "\n");
    }
    return ctr;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:32,代码来源:MetaMatch2.java

示例5: generateTestCaseData

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public Vector generateTestCaseData(String scheme, String version, int number) {
	   Vector w = new Vector();
	   String target = null;
	   String source = null;
	   String property_name = null;
	   String rel_search_association = null;
	   String rel_search_rela = null;
	   String direction = null;
	   String propertyName = null;
	   String relationshipSourceName = null;
	   String relationshipSourceCode = null;
	   String relationshipName = null;
	   TestCase testCase = null;
	   propertyName = null;
	   relationshipSourceName = null;
	   relationshipSourceCode = null;
	   relationshipName = null;
	   source = null;

       for (int i=0; i<number; i++) {
		   ResolvedConceptReference rcr = generateResolvedConceptReference();
		   String code = rcr.getConceptCode();
		   String name = rcr.getEntityDescription().getContent();
		   String propertyNameAndValue = generateProperty(scheme, version, code);
		   String associationNameAndValueAndSource = generateRelationship(scheme, version, code);

//System.out.println("*propertyNameAndValue: " + propertyNameAndValue);
//System.out.println("*associationNameAndValueAndSource: " + associationNameAndValueAndSource);


		   source = generateSource();
		   //CL429748$Blood$presentation$Blood$true$HEMATOPOIETIC AND RETICULOENDOTHELIAL SYSTEMS$CL028727$CHD$MTHHH
		   String data = scheme + "$" + version + "$" + code + "$" + name + "$" + propertyNameAndValue + "$" + associationNameAndValueAndSource + "$" + source;
		   w.add(data);
	   }
	   return w;
   }
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:38,代码来源:NCImTestCaseDataGenerator.java

示例6: printNavigationTabTest

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public void printNavigationTabTest(PrintWriter out) {
 ResolvedConceptReference rcr = getRandomResolvedConceptReference();
 String code = rcr.getConceptCode();
 test_counter++;
    out.println("    @Test");
    out.println("    public void testNavigationTabTestCase_" + test_counter + "() throws Exception {");
    out.println("    	driver.get(baseUrl + \"/ncimbrowser/\");");
    out.println("		int searchType = 0; //(NAVIGATION_TAB)");
    out.println("    	try {");
    out.println("	    	driver.findElement(By.id(\"matchText\")).clear();");
    out.println("			Thread.sleep(1000);");
    out.println("			driver.findElement(By.id(\"matchText\")).sendKeys(\"" + code + "\");");
    out.println("			Thread.sleep(1000);");
    out.println("			driver.findElement(By.id(\"searchTarget1\")).click();");
    out.println("			Thread.sleep(1000);");
    out.println("			driver.findElement(By.id(\"searchTerm:search\")).click();");
    out.println("			Thread.sleep(1000);");
    out.println("			driver.findElement(By.name(\"sdTab\")).click();");
    out.println("			Thread.sleep(1000);");
    out.println("			driver.findElement(By.name(\"relTab\")).click();");
    out.println("			Thread.sleep(2000);");
    out.println("			driver.findElement(By.name(\"sourceTab\")).click();");
    out.println("			Thread.sleep(2000);");
    out.println("			driver.findElement(By.name(\"vaTab\")).click();");
    out.println("			Thread.sleep(1000);");
    out.println("			driver.findElement(By.cssSelector(\"div.vocabularynamebanner\")).click();");
    out.println("			Thread.sleep(1000);");
    out.println("			assertTrue(true);");
    out.println("    	} catch (Exception ex) {");
    out.println("			ex.printStackTrace();");
    out.println("			assertTrue(false);");
    out.println("    	}");
    out.println("    }");
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:35,代码来源:NCImUITestGenerator.java

示例7: printTestTermTypeDefinitionsHelp

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public void printTestTermTypeDefinitionsHelp(PrintWriter out) {
 String method_name = "testTermTypeDefinitionsHelp";
 out.println("    @Test // (" + method_name + ")");
 out.println("    public void testTermTypeDefinitionsHelp() throws Exception {");
 out.println("		driver.get(baseUrl + \"/ncimbrowser/\");");
 String scheme = gov.nih.nci.evs.browser.common.Constants.NCI_METATHESAURUS;
 String version = NCIm_PROD_Version;

 //ResolvedConceptReferenceList testCases = testUtils.generateTestCases(scheme, version, 10, TestCaseGenerator.TYPE_TERMINOLOGY);
 ResolvedConceptReferenceList testCases = ncimTestCases;
 int n = rvGenerator.uniform(0, testCases.getResolvedConceptReferenceCount()-1);
 ResolvedConceptReference rcr = (ResolvedConceptReference) testCases.getResolvedConceptReference(n);

 if (rcr == null) {
  	System.out.println("ResolvedConceptReference is NULL -- return ");
 }
 String code = rcr.getConceptCode();
    out.println("        driver.findElement(By.xpath(\"//input[@name='algorithm'][@value='exactMatch']\")).click();");
 out.println("		driver.findElement(By.name(\"matchText\")).clear();");
 out.println("		driver.findElement(By.id(\"searchTarget1\")).click();");
 out.println("		driver.findElement(By.name(\"matchText\")).sendKeys(\"" + code + "\");");

    out.println("		driver.findElement(By.id(\"searchTerm:search\")).click();");
    out.println("		Thread.sleep(1000);");
    out.println("		driver.findElement(By.name(\"sdTab\")).click();");
    out.println("		Thread.sleep(1000);");
    out.println("		driver.findElement(By.cssSelector(\"img[alt=\\\"Term Type Definitions\\\"]\")).click();");

    out.println("		String bodyText = null;");
    out.println("		String matchedString = \"Abbreviation in any source vocabulary\";");
    out.println("		Thread.sleep(4000);");
    out.println("		bodyText = getPopupWindowBodyText(driver);");
    out.println("		assertTrue(bodyText.contains(matchedString));");
    out.println("		Thread.sleep(1000);    ");
 out.println("    }");
 out.println("");
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:38,代码来源:NCImUITestGenerator.java

示例8: printTestSourceHelp

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public void printTestSourceHelp(PrintWriter out) {
 String method_name = "testSourceHelp";
 out.println("    @Test // (" + method_name + ")");
 out.println("    public void testSourceHelp() throws Exception {");
 out.println("		driver.get(baseUrl + \"/ncimbrowser/\");");
 String scheme = gov.nih.nci.evs.browser.common.Constants.NCI_METATHESAURUS;
 String version = NCIm_PROD_Version;
 //ResolvedConceptReferenceList testCases = testUtils.generateTestCases(scheme, version, 10, TestCaseGenerator.TYPE_TERMINOLOGY);
 ResolvedConceptReferenceList testCases = ncimTestCases;//testUtils.generateTestCases(scheme, version, 10, TestCaseGenerator.TYPE_TERMINOLOGY);
 int n = rvGenerator.uniform(0, testCases.getResolvedConceptReferenceCount()-1);
 ResolvedConceptReference rcr = (ResolvedConceptReference) testCases.getResolvedConceptReference(n);
 if (rcr == null) {
  	System.out.println("ResolvedConceptReference is NULL -- return ");
 }
 String code = rcr.getConceptCode();
    out.println("        driver.findElement(By.xpath(\"//input[@name='algorithm'][@value='exactMatch']\")).click();");
 out.println("		driver.findElement(By.name(\"matchText\")).clear();");
 out.println("		driver.findElement(By.id(\"searchTarget1\")).click();");
 out.println("		driver.findElement(By.name(\"matchText\")).sendKeys(\"" + code + "\");");

    out.println("		driver.findElement(By.id(\"searchTerm:search\")).click();");
    out.println("		Thread.sleep(1000);");
    out.println("		driver.findElement(By.name(\"sdTab\")).click();");
    out.println("		Thread.sleep(1000);");
    out.println("		driver.findElement(By.cssSelector(\"img[alt=\\\"Source List\\\"]\")).click();");

    out.println("		String bodyText = null;");
    out.println("		String matchedString = \"National Cancer Institute Thesaurus\";");
    out.println("		Thread.sleep(4000);");
    out.println("		bodyText = getPopupWindowBodyText(driver);");
    out.println("		assertTrue(bodyText.contains(matchedString));");
    out.println("		Thread.sleep(1000);    ");
 out.println("    }");
 out.println("");
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:36,代码来源:NCImUITestGenerator.java

示例9: generateNCImResolvedConceptReferenceList

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
ResolvedConceptReferenceList generateNCImResolvedConceptReferenceList(int number) {
  String scheme = gov.nih.nci.evs.browser.common.Constants.NCI_THESAURUS;
  String version = null;
  ResolvedConceptReferenceList rcrl = testUtils.generateTestCases(scheme, version, number, TestCaseGenerator.TYPE_TERMINOLOGY);
//Generate NCI Thesaurus
// map NCI Thesaurus to NCIm Metahesaurus
  String ncim_scheme = gov.nih.nci.evs.browser.common.Constants.NCI_METATHESAURUS;
  String ncim_version = NCIm_PROD_Version;
  ResolvedConceptReferenceList testCases = new ResolvedConceptReferenceList();
     if (rcrl != null) {
   for (int i=0; i<rcrl.getResolvedConceptReferenceCount(); i++) {
	   ResolvedConceptReference rcr = (ResolvedConceptReference) rcrl.getResolvedConceptReference(i);
	   String code = rcr.getConceptCode();
	   Vector v = metathesaurusUtils.getMatchedMetathesaurusCUIs(scheme, version, null, code);
	   if (v != null && v.size() > 0) {
		   ResolvedConceptReference ncim_rcr = new ResolvedConceptReference();
		   //Entity entity = conceptDetails.getConceptByCode(ncim_scheme, ncim_version, code);

		   Entity entity = new Entity();
		   String cui = (String) v.elementAt(0);
		   entity.setEntityCodeNamespace(ncim_scheme);
		   entity.setEntityCode(cui);

		   ncim_rcr.setEntity(entity);
		   ncim_rcr.setConceptCode(code);
		   ncim_rcr.setCodingSchemeName(ncim_scheme);
		   //ncim_rcr.setEntityDescription(entity.getEntityDescription());
		   testCases.addResolvedConceptReference(ncim_rcr);
		   if (testCases.getResolvedConceptReferenceCount() == NCIM_TEST_CASES) break;
       }
   }

  } else {
  		System.out.println("WARNING: generateNCImResolvedConceptReferenceList rcrl returns null???");
     }
  return testCases;
 }
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:38,代码来源:NCImUITestGenerator.java

示例10: printConcepts

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
private void printConcepts(ResolvedConceptReferencesIterator iterator,
    int maxToReturn) throws Exception {
    _logger.debug(SEPARATOR);
    int i = 0, size = iterator.numberRemaining();
    while (iterator.hasNext()) {
        ResolvedConceptReference[] rcrs =
            iterator.next(maxToReturn).getResolvedConceptReference();
        for (ResolvedConceptReference rcr : rcrs) {
            String code = rcr.getConceptCode();
            String name = rcr.getEntityDescription().getContent();
            _logger.debug(++i + ") " + code + ": " + name);
        }
    }
    _logger.debug("size: " + size);
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:16,代码来源:ContainsRelationTest.java

示例11: generateViewHierarchyTests

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public void generateViewHierarchyTests() {
  String target = null;
  TestCase testCase = null;
  for (int i=0; i<browserHomeDisplayLabels.size(); i++) {
   String label = (String) browserHomeDisplayLabels.elementAt(i);
   String scheme = testUtils.getCodingSchemeName(label);
   String version = testUtils.getCodingSchemeVersion(label);
   boolean skip = true;

         if (scheme != null && scheme.compareTo(gov.nih.nci.evs.browser.common.Constants.NCI_METATHESAURUS) != 0 &&
             !Arrays.asList(gov.nih.nci.evs.browser.common.Constants.TERMINOLOGY_VALUE_SET_NAMES).contains(scheme)) {
	if (metadataUtils.tree_access_allowed(scheme, version)) {
	   ResolvedConceptReferenceList rcrl = testUtils.generateTestCases(scheme, version, ServiceTestCase.SAMPLE_SIZE, TestCaseGenerator.TYPE_TERMINOLOGY);
	   int n = rvGenerator.uniform(0, rcrl.getResolvedConceptReferenceCount()-1);
	   ResolvedConceptReference rcr = (ResolvedConceptReference) rcrl.getResolvedConceptReference(n);
	   String code = rcr.getConceptCode();
	   String name = rcr.getEntityDescription().getContent();

	   // code search
	   test_counter++;
	   int testNumber = test_counter;
	   String browserLink = label;
	   String algorithm = "exactMatch";
	   String matchText = code;
	   target = "Code";
	   testCase = testCaseWriter.createTestCase(testNumber, TestCase.VIEW_HIERARCHY,
	   	                                      browserLink,
	   	                                      scheme, version, algorithm, target, matchText);
	   testCaseWriter.writeTestCase(testCase);
	   skip = false;
    }
      }

      if (skip) {
       System.out.println("\tView Hierarchy -- " + scheme + " " + version + " skipped.");
}

 }
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:40,代码来源:UITestGenerator.java

示例12: generateViewInHierarchyTests

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public void generateViewInHierarchyTests() {
  String target = null;
  TestCase testCase = null;
  for (int i=0; i<browserHomeDisplayLabels.size(); i++) {
   String label = (String) browserHomeDisplayLabels.elementAt(i);
   String scheme = testUtils.getCodingSchemeName(label);
   String version = testUtils.getCodingSchemeVersion(label);
   boolean skip = true;
         if (scheme != null && scheme.compareTo(gov.nih.nci.evs.browser.common.Constants.NCI_METATHESAURUS) != 0 &&
             !Arrays.asList(gov.nih.nci.evs.browser.common.Constants.TERMINOLOGY_VALUE_SET_NAMES).contains(scheme)) {
	if (metadataUtils.tree_access_allowed(scheme, version)) {
	   ResolvedConceptReferenceList rcrl = testUtils.generateTestCases(scheme, version, ServiceTestCase.SAMPLE_SIZE, TestCaseGenerator.TYPE_TERMINOLOGY);
	   int n = rvGenerator.uniform(0, rcrl.getResolvedConceptReferenceCount()-1);
	   ResolvedConceptReference rcr = (ResolvedConceptReference) rcrl.getResolvedConceptReference(n);
	   String code = rcr.getConceptCode();
	   String name = rcr.getEntityDescription().getContent();

	   // code search
	   test_counter++;
	   int testNumber = test_counter;
	   String browserLink = label;
	   String algorithm = "exactMatch";
	   String matchText = code;
	   target = "codes";

	   testCase = testCaseWriter.createTestCase(testNumber, TestCase.VIEW_IN_HIERARCHY,
	   	                                      browserLink,
	   	                                      scheme, version, algorithm, target, matchText);
	   testCaseWriter.writeTestCase(testCase);
	   skip = false;
    }
      }
      if (skip) {
       System.out.println("\tView In Hierarchy -- " + scheme + " " + version + " skipped.");
}
 }
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:38,代码来源:UITestGenerator.java

示例13: printTestHelpInfo

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public void printTestHelpInfo(PrintWriter out) {
 out.println("    public void testHelpInfoPages() throws Exception {");
 out.println("		driver.get(baseUrl + \"/ncitbrowser/\");");
    System.out.println("NCIt_PROD_Version: " + NCIt_PROD_Version);
 String ncit_display_label = "NCI Thesaurus: National Cancer Institute Thesaurus (" + NCIt_PROD_Version + ")";
 System.out.println("ncit_display_label: " + ncit_display_label);

 String scheme = testUtils.getCodingSchemeName(ncit_display_label);
    String version = testUtils.getCodingSchemeVersion(ncit_display_label);

 ResolvedConceptReferenceList testCases = testUtils.generateTestCases(scheme, version, ServiceTestCase.SAMPLE_SIZE, TestCaseGenerator.TYPE_TERMINOLOGY);
 int n = rvGenerator.uniform(0, testCases.getResolvedConceptReferenceCount()-1);
 ResolvedConceptReference rcr = (ResolvedConceptReference) testCases.getResolvedConceptReference(n);

 if (rcr == null) {
  	System.out.println("ResolvedConceptReference is NULL -- return ");
 }
 String code = rcr.getConceptCode();
 out.println("		driver.findElement(By.linkText(\"" + ncit_display_label + "\")).click();");
    out.println("        driver.findElement(By.xpath(\"//input[@name='algorithm'][@value='exactMatch']\")).click();");
    out.println("        driver.findElement(By.xpath(\"//input[@name='selectValueSetSearchOption'][@value='codes']\")).click();");


 out.println("		driver.findElement(By.name(\"matchText\")).clear();");
 out.println("		driver.findElement(By.name(\"matchText\")).sendKeys(\"" + code + "\");");
 out.println("		driver.findElement(By.name(\"searchTerm:search\")).click();");
 out.println("		driver.findElement(By.name(\"sdTab\")).click();");
 out.println("        popUpWindowByImage(\"Term Type Definitions\");");
 out.println("        assertTrue(true);");
 out.println("    }");
 out.println("");
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:33,代码来源:UITestGenerator.java

示例14: printHierarchyBranch

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
 * Handles recursive display of hierarchy for the given start node,
 * up to the maximum specified depth.
 * @param lbscm
 * @param scheme
 * @param csvt
 * @param hierarchyID
 * @param branchRoot
 * @param currentDepth
 * @param maxDepth
 * @param assocName
 * @throws LBException
 */
protected void printHierarchyBranch(
		LexBIGServiceConvenienceMethods lbscm,
		String scheme,
		CodingSchemeVersionOrTag csvt,
		String hierarchyID,
		ResolvedConceptReference branchRoot,
		int currentDepth,
		int maxDepth,
		String assocName) throws LBException
{
	// Print the referenced node; indent based on current depth ...
	StringBuffer indent = new StringBuffer();
	for (int i = 0; i < currentDepth; i++)
		indent.append("    ");

	String code = branchRoot.getConceptCode();
	EntityDescription desc = branchRoot.getEntityDescription();
	Util.displayMessage(new StringBuffer()
		.append(indent)
		.append(assocName != null ? (assocName+"->") : "")
		.append(code).append(':').append(desc != null ? desc.getContent() : "")
		.toString());

	// Print each association and recurse ...
	if (currentDepth < maxDepth) {
		AssociationList assocList = lbscm.getHierarchyLevelNext(scheme, csvt, hierarchyID, code, false, null);
		if (assocList != null)
			for (int i = 0; i < assocList.getAssociationCount(); i++) {
				Association assoc = assocList.getAssociation(i);
				AssociatedConceptList nodes = assoc.getAssociatedConcepts();
				for (Iterator<AssociatedConcept> subsumed = nodes.iterateAssociatedConcept(); subsumed.hasNext(); ) {
					printHierarchyBranch(lbscm, scheme, csvt, hierarchyID, subsumed.next(), currentDepth + 1, maxDepth, assoc.getDirectionalName());
				}
			}
	}
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:50,代码来源:ListHierarchy.java

示例15: 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);
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:50,代码来源:SearchUtils.java


注:本文中的org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference.getConceptCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。