software/test/performance/src/org/LexGrid/LexBIG/example/MetaMatch.java
/**
	 * Display concepts and related text strings matching the given string.
	 * @param s The test string.
	 * @param lbSvc
	 * @param scheme
	 * @param csvt
	 * @throws LBException
	 */
Display concepts and related text strings matching the given string.
@param s The test string.
Display concepts and related text strings matching the given string . @param s The test string .
protected void matchSynonyms(String s, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
		throws LBException
	{
		Util.displayMessage("\n*** Matching synonyms (incorporates partial normalization/stemming).");
		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]);
		}
		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};
		ResolvedConceptReferenceList matches =
			nodes.resolveToList(sortCriteria, null, fetchTypes, -1);
		if (matches.getResolvedConceptReferenceCount() > 0) {
			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.");
		}
	}
protected void matchSynonyms ( String s , EVSApplicationService lbSvc , String scheme , CodingSchemeVersionOrTag csvt ) throws LBException { Util . displayMessage ( "\n*** Matching synonyms (incorporates partial normalization/stemming)." ) ; 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 ] ) ; } 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 } ; ResolvedConceptReferenceList matches = nodes . resolveToList ( sortCriteria , null , fetchTypes , - 1 ) ; if ( matches . getResolvedConceptReferenceCount ( ) > 0 ) { 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." ) ; } }
Display concepts and related text strings matching the given string.
Display concepts and related text strings matching the given string .
// 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).
 // Define the code set and add restrictions ...
 // Resolve and analyze the result ...
 // Found a match?  If so, sort according to relevance.
 // 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.
