sparqlGraphLibrary/src/main/java/com/ge/research/semtk/plotting/PlotlyPlotSpec.java
@SuppressWarnings("unchecked")
	private boolean applyTableToJsonStringField(JSONObject jObj, String key, Table table) throws Exception {
		
		String s = (String) jObj.get(key);	// e.g. SEMTK_TABLE.col[colA]
		if (!s.startsWith(PREFIX + ".")) return false;
		
		// TODO if already replaced this field, then return
				
		String[] sSplit = s.replaceAll("\\s","").split("[\\.\\[\\]]");  // e.g. split SEMTK_TABLE.col[colA] into ["SEMTK_TABLE", "col", "colA"]
		if(sSplit[0].equals(PREFIX) && sSplit[1].equals(CMD_COL)){
			String colName = sSplit[2].trim();
			int colIndex = table.getColumnIndex(colName);
			if (colIndex == -1) {
				throw new Exception("Plot spec contains column which does not exist in table: '" + colName + "'");
			}
			
			JSONArray jArr = new JSONArray();
			
			if (table.getColumnXSDType(colName).isInt()) {
				for (int r=0; r < table.getNumRows(); r++) {
					jArr.add(table.getCellAsInt(r, colIndex));
				}
			} else if (table.getColumnXSDType(colName).isFloat()) {
				for (int r=0; r < table.getNumRows(); r++) {
					jArr.add(table.getCellAsFloat(r, colIndex));
				}
			} else  {
				for (int r=0; r < table.getNumRows(); r++) {
					jArr.add(table.getCellAsString(r, colIndex));
				}
			}
			
			jObj.put(key, jArr);
			return true;

		}else{
			throw new Exception("Unsupported data specification for plotting: " + s);
		}
		
	}
/**
	 * Process the given existing string field of a JSON object
	 * @param jObj the containing JSON object 
	 * @param key the key of a known string field
	 * @param table replace the string field with data from this table
	 * @throws Exception
	 */
Process the given existing string field of a JSON object
@param jObj the containing JSON object
@param key the key of a known string field
@param table replace the string field with data from this table
@throws Exception
Process the given existing string field of a JSON object @param jObj the containing JSON object @param key the key of a known string field @param table replace the string field with data from this table @throws Exception
@SuppressWarnings("unchecked")
	private boolean applyTableToJsonStringField(JSONObject jObj, String key, Table table) throws Exception {
		String s = (String) jObj.get(key);	
		if (!s.startsWith(PREFIX + ".")) return false;
		String[] sSplit = s.replaceAll("\\s","").split("[\\.\\[\\]]");  
		if(sSplit[0].equals(PREFIX) && sSplit[1].equals(CMD_COL)){
			String colName = sSplit[2].trim();
			int colIndex = table.getColumnIndex(colName);
			if (colIndex == -1) {
				throw new Exception("Plot spec contains column which does not exist in table: '" + colName + "'");
			}
			JSONArray jArr = new JSONArray();
			if (table.getColumnXSDType(colName).isInt()) {
				for (int r=0; r < table.getNumRows(); r++) {
					jArr.add(table.getCellAsInt(r, colIndex));
				}
			} else if (table.getColumnXSDType(colName).isFloat()) {
				for (int r=0; r < table.getNumRows(); r++) {
					jArr.add(table.getCellAsFloat(r, colIndex));
				}
			} else  {
				for (int r=0; r < table.getNumRows(); r++) {
					jArr.add(table.getCellAsString(r, colIndex));
				}
			}
			jObj.put(key, jArr);
			return true;
		}else{
			throw new Exception("Unsupported data specification for plotting: " + s);
		}
	}
@ SuppressWarnings ( "unchecked" ) private boolean applyTableToJsonStringField ( JSONObject jObj , String key , Table table ) throws Exception { String s = ( String ) jObj . get ( key ) ; if ( ! s . startsWith ( PREFIX + "." ) ) return false ; String [ ] sSplit = s . replaceAll ( "\\s" , "" ) . split ( "[\\.\\[\\]]" ) ; if ( sSplit [ 0 ] . equals ( PREFIX ) && sSplit [ 1 ] . equals ( CMD_COL ) ) { String colName = sSplit [ 2 ] . trim ( ) ; int colIndex = table . getColumnIndex ( colName ) ; if ( colIndex == - 1 ) { throw new Exception ( "Plot spec contains column which does not exist in table: '" + colName + "'" ) ; } JSONArray jArr = new JSONArray ( ) ; if ( table . getColumnXSDType ( colName ) . isInt ( ) ) { for ( int r = 0 ; r < table . getNumRows ( ) ; r ++ ) { jArr . add ( table . getCellAsInt ( r , colIndex ) ) ; } } else if ( table . getColumnXSDType ( colName ) . isFloat ( ) ) { for ( int r = 0 ; r < table . getNumRows ( ) ; r ++ ) { jArr . add ( table . getCellAsFloat ( r , colIndex ) ) ; } } else { for ( int r = 0 ; r < table . getNumRows ( ) ; r ++ ) { jArr . add ( table . getCellAsString ( r , colIndex ) ) ; } } jObj . put ( key , jArr ) ; return true ; } else { throw new Exception ( "Unsupported data specification for plotting: " + s ) ; } }
Process the given existing string field of a JSON object
 @param jObj the containing JSON object
 @param key the key of a known string field
 @param table replace the string field with data from this table
 @throws Exception
Process the given existing string field of a JSON object @param jObj the containing JSON object @param key the key of a known string field @param table replace the string field with data from this table @throws Exception
// e.g. SEMTK_TABLE.col[colA] // TODO if already replaced this field, then return // e.g. split SEMTK_TABLE.col[colA] into ["SEMTK_TABLE", "col", "colA"]