connectionUtils/src/main/java/com/ge/research/semtk/sparqlX/VirtuosoSparqlEndpointInterface.java
public JSONObject executeUpload(byte[] owl) throws AuthorizationException, Exception{
		this.authorizeUpload();
		
		HttpHost targetHost = this.buildHttpHost();
        HttpClient httpclient = this.buildHttpClient(targetHost.getSchemeName());
		BasicHttpContext localcontext = this.buildHttpContext(targetHost);
		HttpPost httppost = new HttpPost(this.getUploadURL());
		
		this.addHeaders(httppost, SparqlResultTypes.HTML);
		 
		MultipartEntityBuilder builder = MultipartEntityBuilder.create();    
	
		builder.addTextBody("graph-uri", this.graph);
		builder.addBinaryBody("res-file", owl);
		HttpEntity entity = builder.build();
		httppost.setEntity(entity);
		
		/*  THIS IS THE MULTIPART FORMAT WE NEED TO SEND.
		
		Content-Type: multipart/form-data; boundary=---------------------------32932166721282
		Content-Length: 234
		
		-----------------------------32932166721282
		Content-Disposition: form-data; name="graph-uri"
		
		http://www.kdl.ge.com/changeme
		-----------------------------32932166721282
		Content-Disposition: form-data; name="res-file"; filename="employee.owl"
		Content-Type: application/octet-stream
		
		<rdf:RDF
		    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
		    xmlns:owl="http://www.w3.org/2002/07/owl#"
		    xmlns="http://kdl.ge.com/pd/employee#"
		    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
		  .
		  .
		  .
		</rdf:RDF>
		
		-----------------------------32932166721282--

		 */
		
		executeTestQuery();

		HttpResponse response_http = httpclient.execute(targetHost, httppost, localcontext);
		HttpEntity resp_entity = response_http.getEntity();
		// get response with HTML tags removed
		String responseTxt = EntityUtils.toString(resp_entity, "UTF-8").replaceAll("\\<.*?>"," ");

		SimpleResultSet ret = new SimpleResultSet();
		
		if(responseTxt.trim().isEmpty()){
			// success or bad login :-(
			ret.setSuccess(true);
		} else {
			ret.setSuccess(false);
			ret.addRationaleMessage("SparqlEndpointInterface.executeAuthUploadOwl", responseTxt);
		}
		resp_entity.getContent().close();
		return ret.toJson();
	}
/**
	 * Execute an auth query using POST, and using AUTH if this.userName != null
	 * @return a JSONObject wrapping the results. in the event the results were tabular, they can be obtained in the JsonArray "@Table". if the results were a graph, use "@Graph" for json-ld
	 * @throws Exception
	 */
Execute an auth query using POST, and using AUTH if this.userName != null
@return a JSONObject wrapping the results. in the event the results were tabular, they can be obtained in the JsonArray "@Table". if the results were a graph, use "@Graph" for json-ld
@throws Exception
Execute an auth query using POST and using AUTH if this . userName ! = null @return a JSONObject wrapping the results . in the event the results were tabular they can be obtained in the JsonArray " @Table " . if the results were a graph use " @Graph " for json - ld @throws Exception
public JSONObject executeUpload(byte[] owl) throws AuthorizationException, Exception{
		this.authorizeUpload();
		HttpHost targetHost = this.buildHttpHost();
        HttpClient httpclient = this.buildHttpClient(targetHost.getSchemeName());
		BasicHttpContext localcontext = this.buildHttpContext(targetHost);
		HttpPost httppost = new HttpPost(this.getUploadURL());
		this.addHeaders(httppost, SparqlResultTypes.HTML);
		MultipartEntityBuilder builder = MultipartEntityBuilder.create();    
		builder.addTextBody("graph-uri", this.graph);
		builder.addBinaryBody("res-file", owl);
		HttpEntity entity = builder.build();
		httppost.setEntity(entity);
		/*  THIS IS THE MULTIPART FORMAT WE NEED TO SEND.
		Content-Type: multipart/form-data; boundary=---------------------------32932166721282
		Content-Length: 234
		-----------------------------32932166721282
		Content-Disposition: form-data; name="graph-uri"
		http://www.kdl.ge.com/changeme
		-----------------------------32932166721282
		Content-Disposition: form-data; name="res-file"; filename="employee.owl"
		Content-Type: application/octet-stream
		<rdf:RDF
		    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
		    xmlns:owl="http://www.w3.org/2002/07/owl#"
		    xmlns="http://kdl.ge.com/pd/employee#"
		    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
		  .
		  .
		  .
		</rdf:RDF>
		-----------------------------32932166721282--
		 */
		executeTestQuery();
		HttpResponse response_http = httpclient.execute(targetHost, httppost, localcontext);
		HttpEntity resp_entity = response_http.getEntity();
		String responseTxt = EntityUtils.toString(resp_entity, "UTF-8").replaceAll("\\<.*?>"," ");
		SimpleResultSet ret = new SimpleResultSet();
		if(responseTxt.trim().isEmpty()){
			ret.setSuccess(true);
		} else {
			ret.setSuccess(false);
			ret.addRationaleMessage("SparqlEndpointInterface.executeAuthUploadOwl", responseTxt);
		}
		resp_entity.getContent().close();
		return ret.toJson();
	}
public JSONObject executeUpload ( byte [ ] owl ) throws AuthorizationException , Exception { this . authorizeUpload ( ) ; HttpHost targetHost = this . buildHttpHost ( ) ; HttpClient httpclient = this . buildHttpClient ( targetHost . getSchemeName ( ) ) ; BasicHttpContext localcontext = this . buildHttpContext ( targetHost ) ; HttpPost httppost = new HttpPost ( this . getUploadURL ( ) ) ; this . addHeaders ( httppost , SparqlResultTypes . HTML ) ; MultipartEntityBuilder builder = MultipartEntityBuilder . create ( ) ; builder . addTextBody ( "graph-uri" , this . graph ) ; builder . addBinaryBody ( "res-file" , owl ) ; HttpEntity entity = builder . build ( ) ; httppost . setEntity ( entity ) ; /*  THIS IS THE MULTIPART FORMAT WE NEED TO SEND.
		
		Content-Type: multipart/form-data; boundary=---------------------------32932166721282
		Content-Length: 234
		
		-----------------------------32932166721282
		Content-Disposition: form-data; name="graph-uri"
		
		http://www.kdl.ge.com/changeme
		-----------------------------32932166721282
		Content-Disposition: form-data; name="res-file"; filename="employee.owl"
		Content-Type: application/octet-stream
		
		<rdf:RDF
		    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
		    xmlns:owl="http://www.w3.org/2002/07/owl#"
		    xmlns="http://kdl.ge.com/pd/employee#"
		    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
		  .
		  .
		  .
		</rdf:RDF>
		
		-----------------------------32932166721282--

		 */ executeTestQuery ( ) ; HttpResponse response_http = httpclient . execute ( targetHost , httppost , localcontext ) ; HttpEntity resp_entity = response_http . getEntity ( ) ; String responseTxt = EntityUtils . toString ( resp_entity , "UTF-8" ) . replaceAll ( "\\<.*?>" , " " ) ; SimpleResultSet ret = new SimpleResultSet ( ) ; if ( responseTxt . trim ( ) . isEmpty ( ) ) { ret . setSuccess ( true ) ; } else { ret . setSuccess ( false ) ; ret . addRationaleMessage ( "SparqlEndpointInterface.executeAuthUploadOwl" , responseTxt ) ; } resp_entity . getContent ( ) . close ( ) ; return ret . toJson ( ) ; }
Execute an auth query using POST, and using AUTH if this.userName != null
 @return a JSONObject wrapping the results.
Execute an auth query using POST and using AUTH if this . userName ! = null @return a JSONObject wrapping the results .
// get response with HTML tags removed // success or bad login :-(