sparqlGraphLibrary/src/main/java/com/ge/research/semtk/sparqlX/dispatch/EdcDispatcher.java
private TableResultSet executeEdcSelect(JSONObject extConstraintsJson, QueryFlags flags) throws Exception{
		TableResultSet retval = null;
		long startTimeMillis;
		
		try{

			// get service info and augmented nodegroup from dispatch service manager
			LocalLogger.logToStdOut("Job " + this.jobID + ": dispatch service manager");
			startTimeMillis = System.currentTimeMillis();
			NodeGroup edcNodegroup = this.dispatchServiceMgr.getEdcNodegroup();
			QueryGenClient edcGenerateClient = this.dispatchServiceMgr.getGenerateClient();
			LocalLogger.logToStdOut("Job " + this.jobID + ": dispatch service manager completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
			
			// get the table to send to the query generation service
			LocalLogger.logToStdOut("Job " + this.jobID + ": prep binning");
			startTimeMillis = System.currentTimeMillis();
			Table locationAndValueTable = this.performEdcPrepBinning(edcNodegroup);	
			LocalLogger.logToStdOut("Job " + this.jobID + ": prep binning completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
			
			if(locationAndValueTable.getNumRows() == 0) {
				// handle empty results
				retval = new TableResultSet(true);
				retval.addResults(new Table(new String[]{}, new String [] {}));
			} else {
			
				// update the status 
				this.updateStatus(10);
				
				// generate queries
				LocalLogger.logToStdOut("Job " + this.jobID + ": generate external queries");
				startTimeMillis = System.currentTimeMillis();
				TableResultSet queryGenResultSet = edcGenerateClient.execute(locationAndValueTable,extConstraintsJson,flags);
				if(!queryGenResultSet.getSuccess()){
					throw new Exception("Could not generate queries: " + queryGenResultSet.getRationaleAsString(","));
				}
				Table queryGenResultTable = queryGenResultSet.getResults();			
				LocalLogger.logToStdOut(queryGenResultTable.toCSVString());
				LocalLogger.logToStdOut("Job " + this.jobID + ": generate external queries completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");	
				retval = new TableResultSet(true);
				
				if (flags != null && flags.isSet(AsynchronousNodeGroupBasedQueryDispatcher.FLAG_DISPATCH_RETURN_QUERIES)) {
					this.updateStatus(60);
					Table queryTable = queryGenResultSet.getTable();
					queryTable.removeColumn("UUID");
					queryTable.insertColumn("EdcMnemonic", "String", 0, this.dispatchServiceMgr.getServiceMnemonic());
					retval.addResults(queryTable);
					
				} else {
					// update the status
					this.updateStatus(20);
					
					// execute queries
					LocalLogger.logToStdOut("Job " + this.jobID + ": execute external queries");
					startTimeMillis = System.currentTimeMillis();
					this.runEdcThreads(queryGenResultTable, 20, 70);
					LocalLogger.logToStdOut("Job " + this.jobID + ": execute external queries completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
					
					// update status
					this.updateStatus(75);
					
					// merge results
					LocalLogger.logToStdOut("Job " + this.jobID + ": fuse results");	
					startTimeMillis = System.currentTimeMillis();
					String[] columnNamesInOrder = this.queryGroupColl.getColumnNames();
					String[] columnTypesInNameOrder = this.getColumnTypes(columnNamesInOrder);  // TODO: figure out how to get column types. they are elusive...
					Table retTable = this.fuseResults(columnNamesInOrder, columnTypesInNameOrder);
					LocalLogger.logToStdOut("Job " + this.jobID + ": fuse results completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
					
					LocalLogger.logToStdOut("Job " + this.jobID + ": add results to table");	
					startTimeMillis = System.currentTimeMillis();
					retval.addResults(retTable);    // this is a slow line because it involves making potentially a lot of JSON never used in this case.
					LocalLogger.logToStdOut("Job " + this.jobID + ": add results to table completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
				}
			}
			this.updateStatus(95);		

			// send to results service
			LocalLogger.logToStdOut("Job " + this.jobID + ": write results");	
			startTimeMillis = System.currentTimeMillis();
			this.sendResultsToService(retval.getTable()); 			
			LocalLogger.logToStdOut("Job " + this.jobID + ": write results completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
			
			this.updateStatus(100);		

		}catch(Exception e){
				// something went awry. set the job to failure. 
				this.updateStatusToFailed(e.getMessage());
				throw e;
		}
		
		return retval;
	}
/**
	 * Run and EDC select query
	 * @param extConstraintsJson
	 * @param flags
	 * @return
	 * @throws Exception
	 */
Run and EDC select query
@param extConstraintsJson
@param flags
@return
@throws Exception
Run and EDC select query @param extConstraintsJson @param flags @return @throws Exception
private TableResultSet executeEdcSelect(JSONObject extConstraintsJson, QueryFlags flags) throws Exception{
		TableResultSet retval = null;
		long startTimeMillis;
		try{
			LocalLogger.logToStdOut("Job " + this.jobID + ": dispatch service manager");
			startTimeMillis = System.currentTimeMillis();
			NodeGroup edcNodegroup = this.dispatchServiceMgr.getEdcNodegroup();
			QueryGenClient edcGenerateClient = this.dispatchServiceMgr.getGenerateClient();
			LocalLogger.logToStdOut("Job " + this.jobID + ": dispatch service manager completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
			LocalLogger.logToStdOut("Job " + this.jobID + ": prep binning");
			startTimeMillis = System.currentTimeMillis();
			Table locationAndValueTable = this.performEdcPrepBinning(edcNodegroup);	
			LocalLogger.logToStdOut("Job " + this.jobID + ": prep binning completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
			if(locationAndValueTable.getNumRows() == 0) {
				retval = new TableResultSet(true);
				retval.addResults(new Table(new String[]{}, new String [] {}));
			} else {
				this.updateStatus(10);
				LocalLogger.logToStdOut("Job " + this.jobID + ": generate external queries");
				startTimeMillis = System.currentTimeMillis();
				TableResultSet queryGenResultSet = edcGenerateClient.execute(locationAndValueTable,extConstraintsJson,flags);
				if(!queryGenResultSet.getSuccess()){
					throw new Exception("Could not generate queries: " + queryGenResultSet.getRationaleAsString(","));
				}
				Table queryGenResultTable = queryGenResultSet.getResults();			
				LocalLogger.logToStdOut(queryGenResultTable.toCSVString());
				LocalLogger.logToStdOut("Job " + this.jobID + ": generate external queries completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");	
				retval = new TableResultSet(true);
				if (flags != null && flags.isSet(AsynchronousNodeGroupBasedQueryDispatcher.FLAG_DISPATCH_RETURN_QUERIES)) {
					this.updateStatus(60);
					Table queryTable = queryGenResultSet.getTable();
					queryTable.removeColumn("UUID");
					queryTable.insertColumn("EdcMnemonic", "String", 0, this.dispatchServiceMgr.getServiceMnemonic());
					retval.addResults(queryTable);
				} else {
					this.updateStatus(20);
					LocalLogger.logToStdOut("Job " + this.jobID + ": execute external queries");
					startTimeMillis = System.currentTimeMillis();
					this.runEdcThreads(queryGenResultTable, 20, 70);
					LocalLogger.logToStdOut("Job " + this.jobID + ": execute external queries completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
					this.updateStatus(75);
					LocalLogger.logToStdOut("Job " + this.jobID + ": fuse results");	
					startTimeMillis = System.currentTimeMillis();
					String[] columnNamesInOrder = this.queryGroupColl.getColumnNames();
					String[] columnTypesInNameOrder = this.getColumnTypes(columnNamesInOrder);  
					Table retTable = this.fuseResults(columnNamesInOrder, columnTypesInNameOrder);
					LocalLogger.logToStdOut("Job " + this.jobID + ": fuse results completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
					LocalLogger.logToStdOut("Job " + this.jobID + ": add results to table");	
					startTimeMillis = System.currentTimeMillis();
					retval.addResults(retTable);    
					LocalLogger.logToStdOut("Job " + this.jobID + ": add results to table completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
				}
			}
			this.updateStatus(95);		
			LocalLogger.logToStdOut("Job " + this.jobID + ": write results");	
			startTimeMillis = System.currentTimeMillis();
			this.sendResultsToService(retval.getTable()); 			
			LocalLogger.logToStdOut("Job " + this.jobID + ": write results completed in " + com.ge.research.semtk.utility.Utility.getSecondsSince(startTimeMillis) + " sec");
			this.updateStatus(100);		
		}catch(Exception e){
				this.updateStatusToFailed(e.getMessage());
				throw e;
		}
		return retval;
	}
private TableResultSet executeEdcSelect ( JSONObject extConstraintsJson , QueryFlags flags ) throws Exception { TableResultSet retval = null ; long startTimeMillis ; try { LocalLogger . logToStdOut ( "Job " + this . jobID + ": dispatch service manager" ) ; startTimeMillis = System . currentTimeMillis ( ) ; NodeGroup edcNodegroup = this . dispatchServiceMgr . getEdcNodegroup ( ) ; QueryGenClient edcGenerateClient = this . dispatchServiceMgr . getGenerateClient ( ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": dispatch service manager completed in " + com . ge . research . semtk . utility . Utility . getSecondsSince ( startTimeMillis ) + " sec" ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": prep binning" ) ; startTimeMillis = System . currentTimeMillis ( ) ; Table locationAndValueTable = this . performEdcPrepBinning ( edcNodegroup ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": prep binning completed in " + com . ge . research . semtk . utility . Utility . getSecondsSince ( startTimeMillis ) + " sec" ) ; if ( locationAndValueTable . getNumRows ( ) == 0 ) { retval = new TableResultSet ( true ) ; retval . addResults ( new Table ( new String [ ] { } , new String [ ] { } ) ) ; } else { this . updateStatus ( 10 ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": generate external queries" ) ; startTimeMillis = System . currentTimeMillis ( ) ; TableResultSet queryGenResultSet = edcGenerateClient . execute ( locationAndValueTable , extConstraintsJson , flags ) ; if ( ! queryGenResultSet . getSuccess ( ) ) { throw new Exception ( "Could not generate queries: " + queryGenResultSet . getRationaleAsString ( "," ) ) ; } Table queryGenResultTable = queryGenResultSet . getResults ( ) ; LocalLogger . logToStdOut ( queryGenResultTable . toCSVString ( ) ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": generate external queries completed in " + com . ge . research . semtk . utility . Utility . getSecondsSince ( startTimeMillis ) + " sec" ) ; retval = new TableResultSet ( true ) ; if ( flags != null && flags . isSet ( AsynchronousNodeGroupBasedQueryDispatcher . FLAG_DISPATCH_RETURN_QUERIES ) ) { this . updateStatus ( 60 ) ; Table queryTable = queryGenResultSet . getTable ( ) ; queryTable . removeColumn ( "UUID" ) ; queryTable . insertColumn ( "EdcMnemonic" , "String" , 0 , this . dispatchServiceMgr . getServiceMnemonic ( ) ) ; retval . addResults ( queryTable ) ; } else { this . updateStatus ( 20 ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": execute external queries" ) ; startTimeMillis = System . currentTimeMillis ( ) ; this . runEdcThreads ( queryGenResultTable , 20 , 70 ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": execute external queries completed in " + com . ge . research . semtk . utility . Utility . getSecondsSince ( startTimeMillis ) + " sec" ) ; this . updateStatus ( 75 ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": fuse results" ) ; startTimeMillis = System . currentTimeMillis ( ) ; String [ ] columnNamesInOrder = this . queryGroupColl . getColumnNames ( ) ; String [ ] columnTypesInNameOrder = this . getColumnTypes ( columnNamesInOrder ) ; Table retTable = this . fuseResults ( columnNamesInOrder , columnTypesInNameOrder ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": fuse results completed in " + com . ge . research . semtk . utility . Utility . getSecondsSince ( startTimeMillis ) + " sec" ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": add results to table" ) ; startTimeMillis = System . currentTimeMillis ( ) ; retval . addResults ( retTable ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": add results to table completed in " + com . ge . research . semtk . utility . Utility . getSecondsSince ( startTimeMillis ) + " sec" ) ; } } this . updateStatus ( 95 ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": write results" ) ; startTimeMillis = System . currentTimeMillis ( ) ; this . sendResultsToService ( retval . getTable ( ) ) ; LocalLogger . logToStdOut ( "Job " + this . jobID + ": write results completed in " + com . ge . research . semtk . utility . Utility . getSecondsSince ( startTimeMillis ) + " sec" ) ; this . updateStatus ( 100 ) ; } catch ( Exception e ) { this . updateStatusToFailed ( e . getMessage ( ) ) ; throw e ; } return retval ; }
Run and EDC select query
 @param extConstraintsJson
 @param flags
 @return
 @throws Exception
Run and EDC select query @param extConstraintsJson @param flags @return @throws Exception
// get service info and augmented nodegroup from dispatch service manager // get the table to send to the query generation service // handle empty results // update the status  // generate queries // update the status // execute queries // update status // merge results // TODO: figure out how to get column types. they are elusive... // this is a slow line because it involves making potentially a lot of JSON never used in this case. // send to results service // something went awry. set the job to failure. 