Class SparqlClient
- java.lang.Object
- 
- org.topbraidlive.client.java.impl.SparqlClient
 
- 
- All Implemented Interfaces:
- ApiFunction,- GetSparqlConnectionApiFunction,- QuerySparqlApiFunction
 
 public final class SparqlClient extends Object implements GetSparqlConnectionApiFunction, QuerySparqlApiFunction 
- 
- 
Constructor SummaryConstructors Constructor Description SparqlClient(ClientConfiguration clientConfiguration, org.apache.http.impl.client.CloseableHttpClient httpClient)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.http.client.methods.CloseableHttpResponseexecute(org.apache.http.client.methods.HttpUriRequest httpUriRequest)protected org.apache.http.client.methods.CloseableHttpResponseget(org.apache.http.client.utils.URIBuilder uriBuilder)protected ClientConfigurationgetClientConfiguration()protected org.apache.http.impl.client.CloseableHttpClientgetHttpClient()org.apache.jena.rdfconnection.RDFConnectiongetSparqlConnection()Interact with the server via SPARQL.protected ClientExceptionnewClientException(org.apache.http.HttpResponse httpResponse)protected org.apache.http.client.utils.URIBuildernewUriBuilder(String relativeUriPath)protected org.apache.http.client.methods.CloseableHttpResponsepostForm(List<org.apache.http.NameValuePair> nameValuePairs, org.apache.http.client.utils.URIBuilder uriBuilder)org.apache.jena.query.QueryExecutionquerySparql(org.apache.jena.query.Query query, Optional<String> defaultGraph)Query the EDG SPARQL endpoint.protected StringtoString(org.apache.http.HttpResponse httpResponse)Convert an HttpResponse to a string, usually for logging.protected StringtoString(org.apache.http.HttpResponse httpResponse, String httpResponseEntity)Convert an HttpResponse to a string, usually for logging.protected static RuntimeExceptionwrap(IOException e)
 
- 
- 
- 
Constructor Detail- 
SparqlClientpublic SparqlClient(ClientConfiguration clientConfiguration, org.apache.http.impl.client.CloseableHttpClient httpClient) 
 
- 
 - 
Method Detail- 
getSparqlConnectionpublic final org.apache.jena.rdfconnection.RDFConnection getSparqlConnection() Description copied from interface:GetSparqlConnectionApiFunctionInteract with the server via SPARQL.- Specified by:
- getSparqlConnectionin interface- GetSparqlConnectionApiFunction
 
 - 
querySparqlpublic final org.apache.jena.query.QueryExecution querySparql(org.apache.jena.query.Query query, Optional<String> defaultGraph)Description copied from interface:QuerySparqlApiFunctionQuery the EDG SPARQL endpoint.- Specified by:
- querySparqlin interface- QuerySparqlApiFunction
- Parameters:
- query- SPARQL query
- defaultGraph- optional default graph URI
- Returns:
- Jena QueryExecution, which must be closed by the caller
 
 - 
wrapprotected static final RuntimeException wrap(IOException e) 
 - 
getClientConfigurationprotected final ClientConfiguration getClientConfiguration() 
 - 
executeprotected final org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest) 
 - 
getprotected final org.apache.http.client.methods.CloseableHttpResponse get(org.apache.http.client.utils.URIBuilder uriBuilder) 
 - 
getHttpClientprotected final org.apache.http.impl.client.CloseableHttpClient getHttpClient() 
 - 
newClientExceptionprotected final ClientException newClientException(org.apache.http.HttpResponse httpResponse) throws IOException - Throws:
- IOException
 
 - 
newUriBuilderprotected final org.apache.http.client.utils.URIBuilder newUriBuilder(String relativeUriPath) 
 - 
postFormprotected final org.apache.http.client.methods.CloseableHttpResponse postForm(List<org.apache.http.NameValuePair> nameValuePairs, org.apache.http.client.utils.URIBuilder uriBuilder) 
 - 
toStringprotected final String toString(org.apache.http.HttpResponse httpResponse) throws IOException Convert an HttpResponse to a string, usually for logging.Consumes the entity (body) in order to convert it to a string. - Throws:
- IOException
 
 - 
toStringprotected final String toString(org.apache.http.HttpResponse httpResponse, String httpResponseEntity) throws IOException Convert an HttpResponse to a string, usually for logging.Uses an entity (body) that has been previously converted to a string. - Throws:
- IOException
 
 
- 
 
-