sparqlQueryService/src/main/java/com/ge/research/semtk/services/sparql/SparqlQueryServiceRestController.java
@ApiOperation(
			value="Upload owl to specified connection information"
			)
	@CrossOrigin
	@RequestMapping(value="/uploadOwl", method= RequestMethod.POST)
	public JSONObject uploadOwl(@RequestParam("serverAndPort") String serverAndPort, 
								@RequestParam("serverType") String serverType, 
								@RequestParam(value="dataset", required=false) String dataset, // deprecated in favor of graph
								@RequestParam(value="graph", required=false) String graph, 
								@RequestParam("user") String user, 
								@RequestParam("password") String password, 
								@RequestParam("owlFile") MultipartFile owlFile, 
								@RequestHeader HttpHeaders headers) {
		HeadersManager.setHeaders(headers);
		
		SimpleResultSet resultSet = null;
		JSONObject simpleResultSetJson = null;
		SparqlEndpointInterface sei = null;
		LocalLogger.logToStdOut("Sparql Query Service start uploadOwl");
		
		
		try {	
			if (serverAndPort == null || serverAndPort.trim().isEmpty() ) throw new Exception("serverAndPort is empty.");
			if (serverType == null || serverType.trim().isEmpty() ) throw new Exception("serverType is empty.");
			
			// handle deprecated dataset
			if (graph == null || graph.trim().isEmpty() ) graph = dataset;
			if (graph == null || graph.trim().isEmpty() ) throw new Exception("graph is empty.");


			sei = SparqlEndpointInterface.getInstance(serverType, serverAndPort, graph, user, password);
			
			if (sei instanceof NeptuneSparqlEndpointInterface) {
				((NeptuneSparqlEndpointInterface)sei).setS3Config(
						serviceProps.getS3ClientRegion(),
						serviceProps.getS3BucketName(), 
						serviceProps.getAwsIamRoleArn());
			}
			
			if (! sei.isAuth()) { 
				throw new Exception("Required SPARQL endpoint user/password weren't provided.");
			}
			
			simpleResultSetJson = sei.executeAuthUploadOwl(owlFile.getBytes());
			SimpleResultSet sResult = SimpleResultSet.fromJson(simpleResultSetJson);
			if (sResult.getSuccess()) {
				uncache(sei);
			}
			
		} catch (Exception e) {			
			LocalLogger.printStackTrace(e);
			resultSet = new SimpleResultSet();
			resultSet.setSuccess(false);
			resultSet.addRationaleMessage(SERVICE_NAME, "uploadOwl", e);
			return resultSet.toJson();
		} finally {
			HeadersManager.setHeaders(new HttpHeaders());
		}		
		
		return simpleResultSetJson;	
	}
// So the SparqlAuthRequestBody is broken into individual string @RequestParams
So the SparqlAuthRequestBody is broken into individual string @RequestParams
So the SparqlAuthRequestBody is broken into individual string @RequestParams
@ApiOperation(
			value="Upload owl to specified connection information"
			)
	@CrossOrigin
	@RequestMapping(value="/uploadOwl", method= RequestMethod.POST)
	public JSONObject uploadOwl(@RequestParam("serverAndPort") String serverAndPort, 
								@RequestParam("serverType") String serverType, 
								@RequestParam(value="dataset", required=false) String dataset, 
								@RequestParam(value="graph", required=false) String graph, 
								@RequestParam("user") String user, 
								@RequestParam("password") String password, 
								@RequestParam("owlFile") MultipartFile owlFile, 
								@RequestHeader HttpHeaders headers) {
		HeadersManager.setHeaders(headers);
		SimpleResultSet resultSet = null;
		JSONObject simpleResultSetJson = null;
		SparqlEndpointInterface sei = null;
		LocalLogger.logToStdOut("Sparql Query Service start uploadOwl");
		try {	
			if (serverAndPort == null || serverAndPort.trim().isEmpty() ) throw new Exception("serverAndPort is empty.");
			if (serverType == null || serverType.trim().isEmpty() ) throw new Exception("serverType is empty.");
			if (graph == null || graph.trim().isEmpty() ) graph = dataset;
			if (graph == null || graph.trim().isEmpty() ) throw new Exception("graph is empty.");
			sei = SparqlEndpointInterface.getInstance(serverType, serverAndPort, graph, user, password);
			if (sei instanceof NeptuneSparqlEndpointInterface) {
				((NeptuneSparqlEndpointInterface)sei).setS3Config(
						serviceProps.getS3ClientRegion(),
						serviceProps.getS3BucketName(), 
						serviceProps.getAwsIamRoleArn());
			}
			if (! sei.isAuth()) { 
				throw new Exception("Required SPARQL endpoint user/password weren't provided.");
			}
			simpleResultSetJson = sei.executeAuthUploadOwl(owlFile.getBytes());
			SimpleResultSet sResult = SimpleResultSet.fromJson(simpleResultSetJson);
			if (sResult.getSuccess()) {
				uncache(sei);
			}
		} catch (Exception e) {			
			LocalLogger.printStackTrace(e);
			resultSet = new SimpleResultSet();
			resultSet.setSuccess(false);
			resultSet.addRationaleMessage(SERVICE_NAME, "uploadOwl", e);
			return resultSet.toJson();
		} finally {
			HeadersManager.setHeaders(new HttpHeaders());
		}		
		return simpleResultSetJson;	
	}
@ ApiOperation ( value = "Upload owl to specified connection information" ) @ CrossOrigin @ RequestMapping ( value = "/uploadOwl" , method = RequestMethod . POST ) public JSONObject uploadOwl ( @ RequestParam ( "serverAndPort" ) String serverAndPort , @ RequestParam ( "serverType" ) String serverType , @ RequestParam ( value = "dataset" , required = false ) String dataset , @ RequestParam ( value = "graph" , required = false ) String graph , @ RequestParam ( "user" ) String user , @ RequestParam ( "password" ) String password , @ RequestParam ( "owlFile" ) MultipartFile owlFile , @ RequestHeader HttpHeaders headers ) { HeadersManager . setHeaders ( headers ) ; SimpleResultSet resultSet = null ; JSONObject simpleResultSetJson = null ; SparqlEndpointInterface sei = null ; LocalLogger . logToStdOut ( "Sparql Query Service start uploadOwl" ) ; try { if ( serverAndPort == null || serverAndPort . trim ( ) . isEmpty ( ) ) throw new Exception ( "serverAndPort is empty." ) ; if ( serverType == null || serverType . trim ( ) . isEmpty ( ) ) throw new Exception ( "serverType is empty." ) ; if ( graph == null || graph . trim ( ) . isEmpty ( ) ) graph = dataset ; if ( graph == null || graph . trim ( ) . isEmpty ( ) ) throw new Exception ( "graph is empty." ) ; sei = SparqlEndpointInterface . getInstance ( serverType , serverAndPort , graph , user , password ) ; if ( sei instanceof NeptuneSparqlEndpointInterface ) { ( ( NeptuneSparqlEndpointInterface ) sei ) . setS3Config ( serviceProps . getS3ClientRegion ( ) , serviceProps . getS3BucketName ( ) , serviceProps . getAwsIamRoleArn ( ) ) ; } if ( ! sei . isAuth ( ) ) { throw new Exception ( "Required SPARQL endpoint user/password weren't provided." ) ; } simpleResultSetJson = sei . executeAuthUploadOwl ( owlFile . getBytes ( ) ) ; SimpleResultSet sResult = SimpleResultSet . fromJson ( simpleResultSetJson ) ; if ( sResult . getSuccess ( ) ) { uncache ( sei ) ; } } catch ( Exception e ) { LocalLogger . printStackTrace ( e ) ; resultSet = new SimpleResultSet ( ) ; resultSet . setSuccess ( false ) ; resultSet . addRationaleMessage ( SERVICE_NAME , "uploadOwl" , e ) ; return resultSet . toJson ( ) ; } finally { HeadersManager . setHeaders ( new HttpHeaders ( ) ) ; } return simpleResultSetJson ; }
So the SparqlAuthRequestBody is broken into individual string @RequestParams
So the SparqlAuthRequestBody is broken into individual string @RequestParams
// deprecated in favor of graph // handle deprecated dataset