• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SortOptionList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.LexGrid.LexBIG.DataModel.Collections.SortOptionList的典型用法代码示例。如果您正苦于以下问题:Java SortOptionList类的具体用法?Java SortOptionList怎么用?Java SortOptionList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SortOptionList类属于org.LexGrid.LexBIG.DataModel.Collections包,在下文中一共展示了SortOptionList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: searchByPresentationProperty

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public ResolvedConceptReferencesIterator searchByPresentationProperty(String codingSchemeURN, String codingSchemeVersion,
                                            String propertyName, String propertyValue, String[] sourceList, String algorithm) {
	ResolvedConceptReferencesIterator iterator = null;
	try {
        CodedNodeSet cns = getEntitiesWithProperty(codingSchemeURN, codingSchemeVersion,
                                                   propertyName, propertyValue, sourceList, algorithm);
           SortOptionList sortOptions = null;
           LocalNameList filterOptions = null;
           LocalNameList propertyNames = null;
           CodedNodeSet.PropertyType[] propertyTypes = null;
           boolean resolveObjects = false;
		iterator = cns.resolve(sortOptions, filterOptions, propertyNames, propertyTypes, resolveObjects);

    } catch (Exception ex) {
		ex.printStackTrace();
	}
	return iterator;
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:19,代码来源:MetathesaurusSearchUtils.java


示例2: resolveValueSetDefinition

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public static ResolvedValueSetDefinition resolveValueSetDefinition(ValueSetDefinition vsDef,
                                                               AbsoluteCodingSchemeVersionReferenceList csVersionList,
                                                               String versionTag,
                                                               HashMap<String, ValueSetDefinition> referencedVSDs,
                                                               SortOptionList sortOptionList) throws LBException {

 try {
	String URL = "http://ncias-q541-v.nci.nih.gov:29080/lexevsapi60";
	URL = "http://localhost:8080/lexevsapi60";
	LexEVSDistributed distributed =
		(LexEVSDistributed)
		ApplicationServiceProvider.getApplicationServiceFromUrl(URL, "EvsServiceInfo");

	LexEVSValueSetDefinitionServices vds = distributed.getLexEVSValueSetDefinitionServices();
             return vds.resolveValueSetDefinition(vsDef,csVersionList,versionTag,referencedVSDs,sortOptionList);
 } catch (Exception ex) {
	ex.printStackTrace();
 }
 return null;
}
 
开发者ID:NCIP,项目名称:nci-value-set-editor,代码行数:21,代码来源:ValueSetUtils.java


示例3: generateResolvedConceptReferences

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public ResolvedConceptReferenceList generateResolvedConceptReferences(String codingScheme, String version, int number) {
	if (version == null) {
		version = codingSchemeDataUtils.getVocabularyVersionByTag(codingScheme, gov.nih.nci.evs.browser.common.Constants.PRODUCTION);
	}

       CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
       if (version != null) {
           csvt.setVersion(version);
	}

	ResolvedConceptReferenceList rcrl = new ResolvedConceptReferenceList();
	try {
		LocalNameList entityTypes = new LocalNameList();
		entityTypes.addEntry("concept");
		CodedNodeSet cns = lbSvc.getNodeSet(codingScheme, csvt, entityTypes);

		SortOptionList sortOptions = null;
		LocalNameList filterOptions = null;
		LocalNameList propertyNames = null;
		CodedNodeSet.PropertyType[] propertyTypes = null;
		boolean resolveObjects = false;
		int maxToReturn = number;
           ResolvedConceptReferenceList rvrlist = cns.resolveToList(sortOptions, filterOptions, propertyNames, propertyTypes, resolveObjects, maxToReturn);

           for (int i=0; i<rvrlist.getResolvedConceptReferenceCount(); i++) {
			ResolvedConceptReference rcr = rvrlist.getResolvedConceptReference(i);
			rcrl.addResolvedConceptReference(rcr);
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return rcrl;
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:34,代码来源:TestCaseGenerator.java


示例4: getConceptDomainNames

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的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;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:35,代码来源:CodingSchemeDataUtils.java


示例5: getPropertyValues

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public HashMap getPropertyValues(String scheme, String version, String propertyType, String propertyName) {
	HashMap hmap = new HashMap();
	CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
	if (version != null) versionOrTag.setVersion(version);
	try {
		CodedNodeSet cns = getNodeSet(scheme, versionOrTag);
		SortOptionList sortOptions = null;
		LocalNameList filterOptions = null;
		LocalNameList propertyNames = Constructors.createLocalNameList(propertyName);
		CodedNodeSet.PropertyType[] propertyTypes = null;
		boolean resolveObjects = true;

		ResolvedConceptReferencesIterator iterator = cns.resolve(sortOptions, filterOptions, propertyNames,
			propertyTypes, resolveObjects);
		while (iterator != null && iterator.hasNext()) {
			ResolvedConceptReference rcr = iterator.next();
			Entity concept = rcr.getEntity();
   			Vector v = getPropertyValues(concept, propertyType, propertyName);
   			if (v != null) {
				if (v.size() > 0) {
					String key = concept.getEntityCode();
					String value = (String) v.elementAt(0);
					hmap.put(key, value);
				}
			}
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return hmap;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:32,代码来源:ConceptDetails.java


示例6: codedNodeGraph2CodedNodeSetIterator

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public ResolvedConceptReferencesIterator codedNodeGraph2CodedNodeSetIterator(
    CodedNodeGraph cng, ConceptReference graphFocus,
    boolean resolveForward, boolean resolveBackward,
    int resolveAssociationDepth, int maxToReturn) {
    CodedNodeSet cns = null;
    try {
        cns =
            cng.toNodeList(graphFocus, resolveForward, resolveBackward,
                resolveAssociationDepth, maxToReturn);

        if (cns == null) {
            _logger.warn("cng.toNodeList returns null???");
            return null;
        }

        SortOptionList sortCriteria = null;
        LocalNameList propertyNames = null;
        CodedNodeSet.PropertyType[] propertyTypes = null;
        ResolvedConceptReferencesIterator iterator = null;
        try {
            iterator =
                cns.resolve(sortCriteria, propertyNames, propertyTypes);
        } catch (Exception e) {
            e.printStackTrace();
        }

        if (iterator == null) {
            _logger.warn("cns.resolve returns null???");
        }
        return iterator;
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:36,代码来源:ConceptDetails.java


示例7: run

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public void run(String text)throws LBException{
	CodingSchemeSummary css = Util.promptForCodeSystem();
	if (css != null) {
		LexBIGService lbSvc = LexBIGServiceImpl.defaultInstance();
		String scheme = css.getCodingSchemeURN();
		CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
		csvt.setVersion(css.getRepresentsVersion());
		
		CodedNodeSet nodes = lbSvc.getCodingSchemeConcepts(scheme, csvt)
			.restrictToStatus(ActiveOption.ALL, null)
			.restrictToMatchingDesignations(
				text,
				SearchDesignationOption.ALL,
				MatchAlgorithms.DoubleMetaphoneLuceneQuery.toString(),
				null);

		// Sort by search engine recommendation & code ...
		SortOptionList sortCriteria =
		    Constructors.createSortOptionList(new String[]{"matchToQuery", "code"});
		
		// Analyze the result ...
		ResolvedConceptReferenceList matches =
			nodes.resolveToList(sortCriteria, null, null, 10);
		if (matches.getResolvedConceptReferenceCount() > 0) {
			for (Enumeration refs = matches.enumerateResolvedConceptReference(); refs.hasMoreElements(); ) {
				ResolvedConceptReference ref = (ResolvedConceptReference) refs.nextElement();
				Util.displayMessage("Matching code: " + ref.getConceptCode());
				Util.displayMessage("\tDescription: " + ref.getEntityDescription().getContent());
			}
		} else {
			Util.displayMessage("No match found!");
		}
	}
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:35,代码来源:SoundsLike.java


示例8: resolveNodeSet

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public ResolvedConceptReferencesIterator resolveNodeSet(CodedNodeSet cns, boolean includeRetiredConcepts) throws Exception {
	
	if (!includeRetiredConcepts) {
		cns.restrictToStatus(CodedNodeSet.ActiveOption.ACTIVE_ONLY, null);
	}
	CodedNodeSet.PropertyType propTypes[] = new CodedNodeSet.PropertyType[2];
	propTypes[0] = CodedNodeSet.PropertyType.PRESENTATION;
	propTypes[1] = CodedNodeSet.PropertyType.DEFINITION;
	
	SortOptionList sortCriteria = Constructors.createSortOptionList(new String[]{"matchToQuery"});
	
	ResolvedConceptReferencesIterator results = cns.resolve(sortCriteria, null,new LocalNameList(), propTypes, true);
	
	return results;
}
 
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:16,代码来源:LexEVSQueryServiceImpl.java


示例9: getConceptWithProperty

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的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;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:75,代码来源:TestConceptDetails.java


示例10: resolveOneHit

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的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;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:81,代码来源:SearchByAssociationIteratorDecorator.java


示例11: getConceptWithProperty

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的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;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:74,代码来源:ConceptDetails.java


示例12: restrictToMatchingProperty

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public static ResolvedConceptReferencesIterator restrictToMatchingProperty(
		                                        String codingSchemeName,
	                                            String version,

	                                            LocalNameList propertyList,
                                                CodedNodeSet.PropertyType[] propertyTypes,
                                                LocalNameList sourceList,
                                                NameAndValueList qualifierList,

 											    java.lang.String matchText,
											    java.lang.String matchAlgorithm,
											    java.lang.String language)
	{
	    CodedNodeSet cns = null;
         ResolvedConceptReferencesIterator iterator = null;
         try {
//            LexBIGService lbSvc = new RemoteServerUtil().createLexBIGService();
//			CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
//			versionOrTag.setVersion(version);
             LexBIGService lbSvc = AppService.getInstance().getLBSvc();
             CodingSchemeVersionOrTag versionOrTag = AppService.getInstance().getCSVT();
             
			if (lbSvc == null)
			{
				_logger.warn("lbSvc = null");
				return null;
			}

			cns = lbSvc.getCodingSchemeConcepts(codingSchemeName, versionOrTag);
			if (cns == null)
			{
				_logger.warn("cns = null");
				return null;
			}

			LocalNameList contextList = null;
            cns = cns.restrictToMatchingProperties(propertyList,
                                           propertyTypes,
                                           sourceList,
                                           contextList,
                                           qualifierList,
                                           matchText,
                                           matchAlgorithm,
                                           language
                                           );

			LocalNameList restrictToProperties = new LocalNameList();
			// KLO, 030509
		    SortOptionList sortCriteria = null;
			    //Constructors.createSortOptionList(new String[]{"matchToQuery"});

            try {
				// resolve nothing
                Util.StopWatch stopWatch = new Util.StopWatch();
                boolean resolveConcepts = false;
                //iterator = cns.resolve(sortCriteria, null, restrictToProperties, null);
                iterator = cns.resolve(sortCriteria, null, restrictToProperties, null, resolveConcepts);

                //ResolvedConceptReferencesIterator     resolve(SortOptionList sortOptions, LocalNameList filterOptions, LocalNameList propertyNames, CodedNodeSet.PropertyType[] propertyTypes, boolean resolveConcepts)

                long duration = stopWatch.duration();
                _debugBuffer.append("DBG: " + stopWatch.getResult(duration) + " * cns.resolve\n");
                _excelBuffer.append(stopWatch.getSecondsString(duration) + "\t");
			} catch (Exception ex) {
				ex.printStackTrace();
				return null;
			}

	    } catch (Exception e) {
			e.printStackTrace();
			return null;
	    }
		return iterator;
	}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:75,代码来源:SearchUtils.java


示例13: codedNodeGraph2CodedNodeSetIterator

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public ResolvedConceptReferencesIterator codedNodeGraph2CodedNodeSetIterator(
						CodedNodeGraph cng,
						ConceptReference graphFocus,
						boolean resolveForward,
						boolean resolveBackward,
						int resolveAssociationDepth,
						int maxToReturn) {
        CodedNodeSet cns = null;
        try {
		 cns = cng.toNodeList(graphFocus,
						 resolveForward,
						 resolveBackward,
						 resolveAssociationDepth,
						 maxToReturn);

		 if (cns == null)
		 {
			 _logger.warn("cng.toNodeList returns null???");
			 return null;
		 }


	     SortOptionList sortCriteria = null;
		    //Constructors.createSortOptionList(new String[]{"matchToQuery", "code"});

		 LocalNameList propertyNames = null;
		 CodedNodeSet.PropertyType[] propertyTypes = null;
		 ResolvedConceptReferencesIterator iterator = null;
		 try {
			 iterator = cns.resolve(sortCriteria, propertyNames, propertyTypes);
		 } catch (Exception e) {
			 e.printStackTrace();
		 }

 		 if(iterator == null)
 		 {
			 _logger.warn("cns.resolve returns null???");
		 }
 		 return iterator;

     } catch (Exception ex) {
		 ex.printStackTrace();
		 return null;
	 }
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:46,代码来源:SearchUtils.java


示例14: restrictToMatchingProperty

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
public static ResolvedConceptReferencesIterator restrictToMatchingProperty(
	                                        String codingSchemeName,
                                            String version,

                                            LocalNameList propertyList,
                                               CodedNodeSet.PropertyType[] propertyTypes,
                                               LocalNameList sourceList,
                                               NameAndValueList qualifierList,

											    java.lang.String matchText,
										    java.lang.String matchAlgorithm,
										    java.lang.String language)
{
    CodedNodeSet cns = null;
        ResolvedConceptReferencesIterator iterator = null;
        try {
           LexBIGService lbSvc = new RemoteServerUtil().createLexBIGService(url);
           //LexBIGService lbSvc = new LexBIGServiceImpl();

		CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
		versionOrTag.setVersion(version);

		if (lbSvc == null)
		{
			_logger.warn("lbSvc = null");
			return null;
		}

		cns = lbSvc.getCodingSchemeConcepts(codingSchemeName, versionOrTag);
		if (cns == null)
		{
			_logger.warn("cns = null");
			return null;
		}

		LocalNameList contextList = null;
           cns = cns.restrictToMatchingProperties(propertyList,
                                          propertyTypes,
                                          sourceList,
                                          contextList,
                                          qualifierList,
                                          matchText,
                                          matchAlgorithm,
                                          language
                                          );

		LocalNameList restrictToProperties = new LocalNameList();
	    SortOptionList sortCriteria =
		    Constructors.createSortOptionList(new String[]{"matchToQuery"});

           try {
               iterator = cns.resolve(sortCriteria, null, restrictToProperties, null);
		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}

    } catch (Exception e) {
		e.printStackTrace();
		return null;
    }
	return iterator;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:64,代码来源:TestSearch.java


示例15: matchSynonyms

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
/**
 * Display concepts and related text strings matching the given string.
 * @param s The test string.
 * @throws LBException
 */
protected void matchSynonyms(String s)
    throws LBException
{
    _buffer.delete(0, _buffer.length());
    Util.StopWatch stopWatch = new Util.StopWatch();
    _buffer.append("*** Matching synonyms (incorporates partial normalization/stemming).\n");

    // An attempt is made to use a partial normalized form on search by
    // removing stop words and utilizing a stemmed query algorithm.
    // Query is performed over all text representations (preferred and
    // non-preferred) that contain every non-stop word in the given
    // string.
    //
    // On resolve, we sort by lucene score ('matchToQuery' sort algorithm).

    StringBuffer searchPhrase = new StringBuffer();
    String[] words = toWords(s, true);
    for (int i = 0; i < words.length; i++) {
        if (i > 0)
            searchPhrase.append(" AND ");
        searchPhrase.append(words[i]);
    }

    // Define the code set and add restrictions ...
    CodedNodeSet nodes = _lbSvc.getCodingSchemeConcepts(_scheme, _csvt);
    nodes.restrictToMatchingDesignations(
        searchPhrase.toString(), SearchDesignationOption.ALL, "StemmedLuceneQuery", null);
    SortOptionList sortCriteria =
        Constructors.createSortOptionList(new String[]{"matchToQuery"});
    PropertyType[] fetchTypes =
        new PropertyType[] {PropertyType.PRESENTATION};

    // Resolve and analyze the result ...
    ResolvedConceptReferenceList matches =
        nodes.resolveToList(sortCriteria, null, fetchTypes, -1);

    // Found a match?  If so, sort according to relevance.
    if (matches.getResolvedConceptReferenceCount() > 0) {
        // NOTE that a match so far only indicates that all of the words in the
        // passed in string also exist in a term assigned to the resolved
        // concepts.  It does not, however, exclude results where the terms
        // also have additional words.  This code currently processes only
        // full matches by calling getReferenceWeight and taking only those
        // values with weight '1'.

        // List concept references with exact correlation of at least one
        // concept term to the compare string.
        final List<String> matchWords = Arrays.asList(words);
        int ctr = 0;
        for (int i = 0; i < matches.getResolvedConceptReferenceCount(); i++) {
            ResolvedConceptReference ref = matches.getResolvedConceptReference(i);
            if (getReferenceWeight(ref, matchWords) == 1)
                ctr = printText(ctr, ref);
        }
    } else {
        _buffer.append("\tNo match found.\n");
    }
    _buffer.append("* " + stopWatch.getResult());
    Util.displayMessage(_buffer.toString());
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:66,代码来源:MetaMatch2.java


示例16: matchWordCompletion

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
/**
 * Attempt to approximate word completion.
 * @param s The test string.
 * @throws LBException
 */
@SuppressWarnings("unchecked")
protected void matchWordCompletion(String s)
    throws LBException
{
    _buffer.delete(0, _buffer.length());
    Util.StopWatch stopWatch = new Util.StopWatch();
    _buffer.append("\n*** Word completion (based on '.') ...\n");

    // For word completion, we just use a regular expression and
    // substitute any alpha-numeric character for the substitution
    // character ('.').
    // Queries are currently made against all text representations,
    // but this could be narrowed.
    //
    // On resolve, we sort by lucene score ('matchToQuery' sort algorithm).

    String prefix = s.toLowerCase();
    String[] words = toWords(prefix, false);
    StringBuffer regex = new StringBuffer();
    regex.append('^');
    for (int i = 0; i < words.length; i++) {
        boolean lastWord = i == words.length - 1;
        String word = words[i];
        regex.append('(');
        if (word.charAt(word.length() - 1) == '.') {
            regex.append(word.substring(0, word.length()));
            regex.append("\\w*");
        }
        else
            regex.append(word);
        regex.append("\\s").append(lastWord ? '*' : '+');
        regex.append(')');
    }
    regex.append("\\Z");

    CodedNodeSet nodes = _lbSvc.getCodingSchemeConcepts(_scheme, _csvt);
    nodes.restrictToMatchingDesignations(
            regex.toString(), SearchDesignationOption.ALL,
            "RegExp", null);
    SortOptionList sortCriteria =
        Constructors.createSortOptionList(new String[]{"matchToQuery"});

    // Resolve and analyze the result ...
    ResolvedConceptReferenceList matches =
        nodes.resolveToList(sortCriteria, null, new PropertyType[] {}, 5);

    // Found a match?
    _buffer.append("* Found via RegExp match (limited to 5 hits)...\n");
    if (matches.getResolvedConceptReferenceCount() > 0) {
        int dotIndex = prefix.indexOf('.');
        if (dotIndex < 0)
            dotIndex = prefix.length();
        int ctr = 0;
        for (int i = 0; i < matches.getResolvedConceptReferenceCount(); i++) {
            ResolvedConceptReference ref = matches.getResolvedConceptReference(i);
            ctr = printText(ctr, ref, false, prefix.substring(0, dotIndex), -1);
        }
    } else {
        _buffer.append("\tNo match found.\n");
    }
    _buffer.append("* " + stopWatch.getResult());
    Util.displayMessage(_buffer.toString());
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:69,代码来源:MetaMatch2.java


示例17: matchSubquery

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
/**
 * Attempt to approximate compositional or sub-query match (e.g., "peptic ulcer"
 * will match the two separate concepts for "peptic" and "ulcer", in case the
 * ontology does not contain any concept matching the full text "peptic ulcer").
 * @param s The test string.
 * @throws LBException
 */
protected void matchSubquery(String s)
    throws LBException
{
    _buffer.delete(0, _buffer.length());
    Util.StopWatch stopWatch = new Util.StopWatch();
    _buffer.append("\n*** Subquery match (incorporates partial normalization/stemming).\n");

    // Similar to synonym match, only allow match on any single non-stop word
    // and only print presentations matching the query.
    //
    // On resolve, we sort by lucene score ('matchToQuery' sort algorithm).

    StringBuffer searchPhrase = new StringBuffer();
    String[] words = toWords(s, true);
    for (int i = 0; i < words.length; i++) {
        if (i > 0)
            searchPhrase.append(" OR ");
        searchPhrase.append(words[i]);
    }

    // Define the code set and add restrictions ...
    CodedNodeSet nodes = _lbSvc.getCodingSchemeConcepts(_scheme, _csvt);
    nodes.restrictToMatchingDesignations(
        searchPhrase.toString(), SearchDesignationOption.ALL, "StemmedLuceneQuery", null);
    SortOptionList sortCriteria =
        Constructors.createSortOptionList(new String[]{"matchToQuery"});
    PropertyType[] fetchTypes =
        new PropertyType[] {PropertyType.PRESENTATION};

    // Resolve and analyze the result ...
    ResolvedConceptReferenceList matches =
        nodes.resolveToList(sortCriteria, null, fetchTypes, -1);

    // Found a match?  If so, print each associated presentation containing at least
    // one word from the query expression (exclude non-matching synonyms).
    if (matches.getResolvedConceptReferenceCount() > 0) {
        int ctr = 0;
        for (int i = 0; i < matches.getResolvedConceptReferenceCount(); i++) {
            ResolvedConceptReference ref = matches.getResolvedConceptReference(i);
            ctr = printText(ctr, ref, words, 1);
        }
    } else {
        _buffer.append("\tNo match found.\n");
    }
    _buffer.append("* " + stopWatch.getResult());
    Util.displayMessage(_buffer.toString());
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:55,代码来源:MetaMatch2.java


示例18: matchSynonyms

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
/**
 * Display concepts and related text strings matching the given string.
 * @param s The test string.
 * @param lbSvc
 * @param scheme
 * @param csvt
 * @throws LBException
 */
protected void matchSynonyms(String s, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
	throws LBException
{
	Util.displayMessage("\n*** Matching synonyms (incorporates partial normalization/stemming).");

	// An attempt is made to use a partial normalized form on search by
	// removing stop words and utilizing a stemmed query algorithm.
	// Query is performed over all text representations (preferred and
	// non-preferred) that contain every non-stop word in the given
	// string.
	//
	// On resolve, we sort by lucene score ('matchToQuery' sort algorithm).

	StringBuffer searchPhrase = new StringBuffer();
	String[] words = toWords(s, true);
	for (int i = 0; i < words.length; i++) {
		if (i > 0)
			searchPhrase.append(" AND ");
		searchPhrase.append(words[i]);
	}

	// Define the code set and add restrictions ...
	CodedNodeSet nodes = lbSvc.getCodingSchemeConcepts(scheme, csvt);
	nodes.restrictToMatchingDesignations(
		searchPhrase.toString(), SearchDesignationOption.ALL, "StemmedLuceneQuery", null);
	SortOptionList sortCriteria =
		Constructors.createSortOptionList(new String[]{"matchToQuery"});
	PropertyType[] fetchTypes =
		new PropertyType[] {PropertyType.PRESENTATION};

	// Resolve and analyze the result ...
	ResolvedConceptReferenceList matches =
		nodes.resolveToList(sortCriteria, null, fetchTypes, -1);

	// Found a match?  If so, sort according to relevance.
	if (matches.getResolvedConceptReferenceCount() > 0) {
		// NOTE that a match so far only indicates that all of the words in the
		// passed in string also exist in a term assigned to the resolved
		// concepts.  It does not, however, exclude results where the terms
		// also have additional words.  This code currently processes only
		// full matches by calling getReferenceWeight and taking only those
		// values with weight '1'.

		// List concept references with exact correlation of at least one
		// concept term to the compare string.
		final List<String> matchWords = Arrays.asList(words);
		for (int i = 0; i < matches.getResolvedConceptReferenceCount(); i++) {
			ResolvedConceptReference ref = matches.getResolvedConceptReference(i);
			if (getReferenceWeight(ref, matchWords) == 1)
				printText(ref);
		}
	} else {
		Util.displayMessage("\tNo match found.");
	}
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:64,代码来源:MetaMatch.java


示例19: matchWordCompletion

import org.LexGrid.LexBIG.DataModel.Collections.SortOptionList; //导入依赖的package包/类
/**
 * Attempt to approximate word completion.
 * @param s The test string.
 * @param lbSvc
 * @param scheme
 * @param csvt
 * @throws LBException
 */
@SuppressWarnings("unchecked")
protected void matchWordCompletion(String s, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
	throws LBException
{
	Util.displayMessage("\n*** Word completion (based on '.') ...");

	// For word completion, we just use a regular expression and
	// substitute any alpha-numeric character for the substitution
	// character ('.').
	// Queries are currently made against all text representations,
	// but this could be narrowed.
	//
	// On resolve, we sort by lucene score ('matchToQuery' sort algorithm).

	String prefix = s.toLowerCase();
	String[] words = toWords(prefix, false);
	StringBuffer regex = new StringBuffer();
	regex.append('^');
	for (int i = 0; i < words.length; i++) {
		boolean lastWord = i == words.length - 1;
		String word = words[i];
		regex.append('(');
		if (word.charAt(word.length() - 1) == '.') {
			regex.append(word.substring(0, word.length()));
			regex.append("\\w*");
		}
		else
			regex.append(word);
		regex.append("\\s").append(lastWord ? '*' : '+');
		regex.append(')');
	}
	regex.append("\\Z");

	CodedNodeSet nodes = lbSvc.getCodingSchemeConcepts(scheme, csvt);
	nodes.restrictToMatchingDesignations(
			regex.toString(), SearchDesignationOption.ALL,
			"RegExp", null);
	SortOptionList sortCriteria =
		Constructors.createSortOptionList(new String[]{"matchToQuery"});

	// Resolve and analyze the result ...
	ResolvedConceptReferenceList matches =
		nodes.resolveToLi 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConsolFuns类代码示例发布时间:2022-05-22
下一篇:
Java TypedUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap