software/test/performance/src/org/LexGrid/LexBIG/example/FindRelatedNodesForTermAndAssoc.java
/**
	 * Display association targets for which the given term participates as source.
	 * @param term
	 * @param assoc
	 * @param lbSvc
	 * @param scheme
	 * @param csvt
	 * @throws LBException
	 */
Display association targets for which the given term participates as source.
Display association targets for which the given term participates as source .
protected void printTargets(String term, String assoc, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
	throws LBException
	{
		/*
		ResolvedConceptReferenceList nodeList =
			lbSvc.getCodingSchemeConcepts(scheme, csvt)
				.restrictToMatchingDesignations(
					term, SearchDesignationOption.PREFERRED_ONLY, "LuceneQuery", null)
				.resolveToList(
					ConvenienceMethods.createSortOptionList(new String[] {SortableProperties.code.name()}),
					null, new PropertyType[] {PropertyType.PRESENTATION}, 1024);
		*/
        CodedNodeSet cns = lbSvc.getCodingSchemeConcepts(scheme, csvt);
		cns = cns.restrictToMatchingDesignations(
					term, SearchDesignationOption.PREFERRED_ONLY, "LuceneQuery", null);
		ResolvedConceptReferenceList nodeList =
			cns.resolveToList(
					ConvenienceMethods.createSortOptionList(new String[] {SortableProperties.code.name()}),
					null, new PropertyType[] {PropertyType.PRESENTATION}, 1024);
		int nodeCount = nodeList.getResolvedConceptReferenceCount();
		for (int i = 0; i < nodeCount; i++) {
			ResolvedConceptReference node = (ResolvedConceptReference) nodeList.getResolvedConceptReference(i);
			ResolvedConceptReferenceList matches =
				lbSvc.getNodeGraph(scheme, csvt, null)
					.restrictToAssociations(ConvenienceMethods.createNameAndValueList(assoc), null)
					.resolveAsList( node,
						true, false, 1, 1, new LocalNameList(), null, null, 1024);
			int matchCount = matches.getResolvedConceptReferenceCount();
			if (matchCount > 0) {
				Util.displayMessage('\n' + node.getConceptCode() + '/' + node.getEntityDescription().getContent());
				for (int j = 0; j < matchCount; j++) {
					ResolvedConceptReference match = (ResolvedConceptReference) matches.getResolvedConceptReference(j);
					Association a = match.getSourceOf().getAssociation(0);
					AssociatedConcept[] acl = a.getAssociatedConcepts().getAssociatedConcept();
					String aName = a.getDirectionalName();
					for (int k = 0; k < acl.length; k++) {
						AssociatedConcept ac = acl[k];
						EntityDescription ed = ac.getEntityDescription();
						Util.displayMessage(
							'\t' + (aName == null ? a.getAssociationName() : aName)
								+ ": " + ac.getConceptCode() + '/'
									+ (ed == null ? "**No Description**" : ed.getContent()));
					}
				}
			}
		}
	}
protected void printTargets ( String term , String assoc , EVSApplicationService lbSvc , String scheme , CodingSchemeVersionOrTag csvt ) throws LBException { /*
		ResolvedConceptReferenceList nodeList =
			lbSvc.getCodingSchemeConcepts(scheme, csvt)
				.restrictToMatchingDesignations(
					term, SearchDesignationOption.PREFERRED_ONLY, "LuceneQuery", null)
				.resolveToList(
					ConvenienceMethods.createSortOptionList(new String[] {SortableProperties.code.name()}),
					null, new PropertyType[] {PropertyType.PRESENTATION}, 1024);
		*/ CodedNodeSet cns = lbSvc . getCodingSchemeConcepts ( scheme , csvt ) ; cns = cns . restrictToMatchingDesignations ( term , SearchDesignationOption . PREFERRED_ONLY , "LuceneQuery" , null ) ; ResolvedConceptReferenceList nodeList = cns . resolveToList ( ConvenienceMethods . createSortOptionList ( new String [ ] { SortableProperties . code . name ( ) } ) , null , new PropertyType [ ] { PropertyType . PRESENTATION } , 1024 ) ; int nodeCount = nodeList . getResolvedConceptReferenceCount ( ) ; for ( int i = 0 ; i < nodeCount ; i ++ ) { ResolvedConceptReference node = ( ResolvedConceptReference ) nodeList . getResolvedConceptReference ( i ) ; ResolvedConceptReferenceList matches = lbSvc . getNodeGraph ( scheme , csvt , null ) . restrictToAssociations ( ConvenienceMethods . createNameAndValueList ( assoc ) , null ) . resolveAsList ( node , true , false , 1 , 1 , new LocalNameList ( ) , null , null , 1024 ) ; int matchCount = matches . getResolvedConceptReferenceCount ( ) ; if ( matchCount > 0 ) { Util . displayMessage ( '\n' + node . getConceptCode ( ) + '/' + node . getEntityDescription ( ) . getContent ( ) ) ; for ( int j = 0 ; j < matchCount ; j ++ ) { ResolvedConceptReference match = ( ResolvedConceptReference ) matches . getResolvedConceptReference ( j ) ; Association a = match . getSourceOf ( ) . getAssociation ( 0 ) ; AssociatedConcept [ ] acl = a . getAssociatedConcepts ( ) . getAssociatedConcept ( ) ; String aName = a . getDirectionalName ( ) ; for ( int k = 0 ; k < acl . length ; k ++ ) { AssociatedConcept ac = acl [ k ] ; EntityDescription ed = ac . getEntityDescription ( ) ; Util . displayMessage ( '\t' + ( aName == null ? a . getAssociationName ( ) : aName ) + ": " + ac . getConceptCode ( ) + '/' + ( ed == null ? "**No Description**" : ed . getContent ( ) ) ) ; } } } } }
Display association targets for which the given term participates as source.
Display association targets for which the given term participates as source .
// Find all nodes that the term matches.
 // For each node, find and print related targets ...
 // Get a graph of relationships for which the node
 // participate as a source.
