connectionUtils/src/main/java/com/ge/research/semtk/sparqlX/SparqlEndpointInterface.java
public HashMap<String,String[]> executeQuery(String query, String[] colNames, boolean expectOneResult) throws Exception {

		TableResultSet res = (TableResultSet) executeQueryAndBuildResultSet(query, SparqlResultTypes.TABLE);
		Table tab = res.getTable();
		HashMap<String,String[]> results = new HashMap<String,String[]>();
		
		String colArr[] = tab.getColumnNames();
		
		for (String colName: colArr){

			String[] column = tab.getColumn(colName);

			if(expectOneResult){
				// expect each column to have exactly one entry
				if(column.length > 1){
					throw new Exception("Expected 1 result for " + colName + ", but retrieved multiple results");
				}else if (column.length < 1){
					throw new Exception("Expected 1 result for " + colName + ", but retrieved zero results");
				}
			}

			results.put(colName, column);
		}

		return results;
	}
/**
	 * Execute a query, retrieving a HashMap of data for a given set of headers.
	 *
	 * See "internal use" note
	 * Note: PEC 3/17/2020 Not sure why this is here.  Only seems to be used by testing.
	 * 
	 * @param query	the query
	 * @param colNames	the headers of the result columns desired.  If null, use all column headers.
	 * @param expectOneResult if true, expect a single row result per column - if zero or multiple results are returned, then error
	 * @return a hashmap: keys are resultHeaders, values are String arrays with contents
	 *
	 */
Execute a query, retrieving a HashMap of data for a given set of headers.
See "internal use" note
Note: PEC 3/17/2020 Not sure why this is here.  Only seems to be used by testing.

@param query the query
@param colNames      the headers of the result columns desired.  If null, use all column headers.
@param expectOneResult if true, expect a single row result per column - if zero or multiple results are returned, then error
@return a hashmap: keys are resultHeaders, values are String arrays with contents
Execute a query retrieving a HashMap of data for a given set of headers . See " internal use " note Note : PEC 3 / 17 / 2020 Not sure why this is here . Only seems to be used by testing . @param query the query @param colNames the headers of the result columns desired . If null use all column headers . @param expectOneResult if true expect a single row result per column - if zero or multiple results are returned then error @return a hashmap : keys are resultHeaders values are String arrays with contents
public HashMap<String,String[]> executeQuery(String query, String[] colNames, boolean expectOneResult) throws Exception {
		TableResultSet res = (TableResultSet) executeQueryAndBuildResultSet(query, SparqlResultTypes.TABLE);
		Table tab = res.getTable();
		HashMap<String,String[]> results = new HashMap<String,String[]>();
		String colArr[] = tab.getColumnNames();
		for (String colName: colArr){
			String[] column = tab.getColumn(colName);
			if(expectOneResult){
				if(column.length > 1){
					throw new Exception("Expected 1 result for " + colName + ", but retrieved multiple results");
				}else if (column.length < 1){
					throw new Exception("Expected 1 result for " + colName + ", but retrieved zero results");
				}
			}
			results.put(colName, column);
		}
		return results;
	}
public HashMap < String , String [ ] > executeQuery ( String query , String [ ] colNames , boolean expectOneResult ) throws Exception { TableResultSet res = ( TableResultSet ) executeQueryAndBuildResultSet ( query , SparqlResultTypes . TABLE ) ; Table tab = res . getTable ( ) ; HashMap < String , String [ ] > results = new HashMap < String , String [ ] > ( ) ; String colArr [ ] = tab . getColumnNames ( ) ; for ( String colName : colArr ) { String [ ] column = tab . getColumn ( colName ) ; if ( expectOneResult ) { if ( column . length > 1 ) { throw new Exception ( "Expected 1 result for " + colName + ", but retrieved multiple results" ) ; } else if ( column . length < 1 ) { throw new Exception ( "Expected 1 result for " + colName + ", but retrieved zero results" ) ; } } results . put ( colName , column ) ; } return results ; }
Execute a query, retrieving a HashMap of data for a given set of headers.
Execute a query retrieving a HashMap of data for a given set of headers .
// expect each column to have exactly one entry