sparqlGraphLibrary/src/main/java/com/ge/research/semtk/ontologyTools/PathExplorer.java
public NodeGroup buildNgWithData(ArrayList<ClassInstance> classInstanceList, ArrayList<ReturnRequest> returns) throws Exception {
		
		ArrayList<String> propRetList = new ArrayList<String>();
		ArrayList<String> enumRetList = new ArrayList<String>();

		// build propRetList and enumRetList
		// TODO: actally use the ReturnRequest domainHintURI
		for (ReturnRequest r : returns) {
			String uri = r.getReturnUri();
			if (this.oInfo.containsClass(uri)) {
				enumRetList.add(uri);
			} else {
				propRetList.add(uri);
			}
		}
		
	
		// try pulling from cache
		NodeGroup cached = this.getFromCache(classInstanceList);
		if (cached != null) {
			this.addDataPropReturn(cached, propRetList);
			this.addEnumReturns(cached, enumRetList);

			return cached;
		}
		
		// handle special simple case: just one class
		if (classInstanceList.size() == 1) {
			NodeGroup ng = new NodeGroup();
			ng.addNodeInstance(classInstanceList.get(0).classUri, this.oInfo, classInstanceList.get(0).instanceUri);
			if (! this.addEnumReturns(ng, enumRetList)) {
				throw new Exception("Error adding enumerated class returns from : " + enumRetList.toString());
			}
			
			
			if (! this.addDataPropReturn(ng, propRetList)) {
				throw new Exception("Error adding property returns from : " + propRetList);
			}
			
			LocalLogger.logToStdOut("...succeeded");
			return ng;
			
		} else {
			// actual work
			return this.buildNgWithData(classInstanceList, propRetList, enumRetList);
		}
	}
/**
	 * Checks cache first
	 * Splits returns into property or enum (TODO still ignores domainHints)
	 * Handles special case of one-node nodegroup
	 * Calls the real buildNgWithData
	 * 
	 * @param classInstanceList  - class/instance uri pairs that need to be in ng.  (instances may be null)
	 * @param returns  - data property or enum classes that need to be returned  (Data property domain must be in classInstanceList) 
	 * @return NodeGroup or null
	 * @throws Exception
	 */
Checks cache first
Splits returns into property or enum (TODO still ignores domainHints)
Handles special case of one-node nodegroup
Calls the real buildNgWithData

@param classInstanceList  - class/instance uri pairs that need to be in ng.  (instances may be null)
@param returns  - data property or enum classes that need to be returned  (Data property domain must be in classInstanceList)
@return NodeGroup or null
@throws Exception
Checks cache first Splits returns into property or enum ( TODO still ignores domainHints ) Handles special case of one - node nodegroup Calls the real buildNgWithData @param classInstanceList - class / instance uri pairs that need to be in ng . ( instances may be null ) @param returns - data property or enum classes that need to be returned ( Data property domain must be in classInstanceList ) @return NodeGroup or null @throws Exception
public NodeGroup buildNgWithData(ArrayList<ClassInstance> classInstanceList, ArrayList<ReturnRequest> returns) throws Exception {
		ArrayList<String> propRetList = new ArrayList<String>();
		ArrayList<String> enumRetList = new ArrayList<String>();
		for (ReturnRequest r : returns) {
			String uri = r.getReturnUri();
			if (this.oInfo.containsClass(uri)) {
				enumRetList.add(uri);
			} else {
				propRetList.add(uri);
			}
		}
		NodeGroup cached = this.getFromCache(classInstanceList);
		if (cached != null) {
			this.addDataPropReturn(cached, propRetList);
			this.addEnumReturns(cached, enumRetList);
			return cached;
		}
		if (classInstanceList.size() == 1) {
			NodeGroup ng = new NodeGroup();
			ng.addNodeInstance(classInstanceList.get(0).classUri, this.oInfo, classInstanceList.get(0).instanceUri);
			if (! this.addEnumReturns(ng, enumRetList)) {
				throw new Exception("Error adding enumerated class returns from : " + enumRetList.toString());
			}
			if (! this.addDataPropReturn(ng, propRetList)) {
				throw new Exception("Error adding property returns from : " + propRetList);
			}
			LocalLogger.logToStdOut("...succeeded");
			return ng;
		} else {
			return this.buildNgWithData(classInstanceList, propRetList, enumRetList);
		}
	}
public NodeGroup buildNgWithData ( ArrayList < ClassInstance > classInstanceList , ArrayList < ReturnRequest > returns ) throws Exception { ArrayList < String > propRetList = new ArrayList < String > ( ) ; ArrayList < String > enumRetList = new ArrayList < String > ( ) ; for ( ReturnRequest r : returns ) { String uri = r . getReturnUri ( ) ; if ( this . oInfo . containsClass ( uri ) ) { enumRetList . add ( uri ) ; } else { propRetList . add ( uri ) ; } } NodeGroup cached = this . getFromCache ( classInstanceList ) ; if ( cached != null ) { this . addDataPropReturn ( cached , propRetList ) ; this . addEnumReturns ( cached , enumRetList ) ; return cached ; } if ( classInstanceList . size ( ) == 1 ) { NodeGroup ng = new NodeGroup ( ) ; ng . addNodeInstance ( classInstanceList . get ( 0 ) . classUri , this . oInfo , classInstanceList . get ( 0 ) . instanceUri ) ; if ( ! this . addEnumReturns ( ng , enumRetList ) ) { throw new Exception ( "Error adding enumerated class returns from : " + enumRetList . toString ( ) ) ; } if ( ! this . addDataPropReturn ( ng , propRetList ) ) { throw new Exception ( "Error adding property returns from : " + propRetList ) ; } LocalLogger . logToStdOut ( "...succeeded" ) ; return ng ; } else { return this . buildNgWithData ( classInstanceList , propRetList , enumRetList ) ; } }
Checks cache first
 Splits returns into property or enum (TODO still ignores domainHints)
 Handles special case of one-node nodegroup
 Calls the real buildNgWithData
Checks cache first Splits returns into property or enum ( TODO still ignores domainHints ) Handles special case of one - node nodegroup Calls the real buildNgWithData
// build propRetList and enumRetList // TODO: actally use the ReturnRequest domainHintURI // try pulling from cache // handle special simple case: just one class // actual work