diff --git a/src/main/java/com/atomgraph/client/model/impl/ProxyResourceBase.java b/src/main/java/com/atomgraph/client/model/impl/ProxyResourceBase.java index 31554457..0a603139 100644 --- a/src/main/java/com/atomgraph/client/model/impl/ProxyResourceBase.java +++ b/src/main/java/com/atomgraph/client/model/impl/ProxyResourceBase.java @@ -45,6 +45,7 @@ import java.util.Locale; import jakarta.inject.Inject; import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.Consumes; import jakarta.ws.rs.NotAcceptableException; import jakarta.ws.rs.NotFoundException; import jakarta.ws.rs.ProcessingException; @@ -228,7 +229,7 @@ public Response get(WebTarget target, Invocation.Builder builder) } catch (MessageBodyProviderNotFoundException ex) { - if (log.isWarnEnabled()) log.debug("Dereferenced URI {} returned non-RDF media type", ex); + if (log.isWarnEnabled()) log.debug("Dereferenced URI {} returned non-RDF media type", webTarget.getUri()); throw new NotAcceptableException(ex); } catch (ProcessingException ex) @@ -336,6 +337,38 @@ public Response post(Model model) post(Entity.entity(model, com.atomgraph.core.MediaType.APPLICATION_NTRIPLES_TYPE)); } + /** + * Forwards POST request with SPARQL query body and returns response from remote resource. + * + * @param sparqlQuery SPARQL query string + * @return response + */ + @POST + @Consumes(com.atomgraph.core.MediaType.APPLICATION_SPARQL_QUERY) + public Response post(String sparqlQuery) + { + if (getWebTarget() == null) throw new NotFoundException("Resource URI not supplied"); + + if (log.isDebugEnabled()) log.debug("POSTing SPARQL query to URI: {}", getWebTarget().getUri()); + + try (Response cr = getWebTarget().request() + .accept(getReadableMediaTypes()) + .post(Entity.entity(sparqlQuery, com.atomgraph.core.MediaType.APPLICATION_SPARQL_QUERY_TYPE))) + { + return getResponse(cr); + } + catch (MessageBodyProviderNotFoundException ex) + { + if (log.isWarnEnabled()) log.debug("Dereferenced URI {} returned non-RDF media type", getWebTarget().getUri()); + throw new NotAcceptableException(ex); + } + catch (ProcessingException ex) + { + if (log.isWarnEnabled()) log.debug("Could not dereference URI: {}", getWebTarget().getUri()); + throw new BadGatewayException(ex); + } + } + /** * Forwards PUT request with RDF dataset body and returns response from remote resource. * diff --git a/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/document.xsl b/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/document.xsl index 0468e36c..137524b4 100644 --- a/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/document.xsl +++ b/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/document.xsl @@ -68,7 +68,7 @@ exclude-result-prefixes="#all"> - + diff --git a/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/sparql.xsl b/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/sparql.xsl index 8daa5e98..f119af19 100644 --- a/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/sparql.xsl +++ b/src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/sparql.xsl @@ -94,7 +94,7 @@ LIMIT 100 - + diff --git a/src/main/webapp/static/js/yasqe.js b/src/main/webapp/static/js/yasqe.js index 4ec508f8..05b51862 100644 --- a/src/main/webapp/static/js/yasqe.js +++ b/src/main/webapp/static/js/yasqe.js @@ -24371,7 +24371,7 @@ root.autocompleteVariables = function(cm, token) { * @method YASQE.fetchFromPrefixCc */ root.fetchFromPrefixCc = function(cm) { - $.get("http://prefix.cc/popular/all.file.json", function(data) { + $.get("https://prefix.cc/popular/all.file.json", function(data) { var prefixArray = []; for ( var prefix in data) { if (prefix == "bif")