For my project i need to use a describe request called from my server (spring with stardog api).
My request is :
DESCRIBE ?x WHERE {
?x rdf:type myOntology:human .
}
If i use these request in Stardog web interface (Stardog 5.3.1) i have a result
But the same request from my server doesn't work and i have an error :
ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.complexible.stardog.security.ResourceExistsException: Unsupported Accept for query type] with root cause
com.complexible.stardog.security.ResourceExistsException: Unsupported Accept for query type
at com.complexible.stardog.protocols.http.client.BaseHttpClient.checkResponseCode(BaseHttpClient.java:530)
at com.complexible.stardog.protocols.http.client.BaseHttpClient.execute(BaseHttpClient.java:363)
How can i allow these kind of request ?
thanks for your answers
Can you show us how you're making the request from the server (Java API, HTTP, etc) and if you're adding an Accept header in any way? The server is expecting to be asked for an RDF format and it doesn't appear to be getting that, whether it's something explicitly set or something being set by whichever client is generating the call.
The issue here is that DESCRIBE is not a select query, so executing it as a SelectQuery is returning this error. What you want is a GraphQuery, since the end result will be an RDF graph:
final String aQuery = "DESCRIBE ?x WHERE {\n" +
" ?x rdf:type myOntology:human .\n" +
"}";
try (Connection c = ConnectionConfiguration.to("myDb").server("http://localhost:5820").credentials("admin", "admin").connect();
GraphQueryResult r = c.graph(aQuery).execute()) {
r.toGraph().forEach(System.out::println);
}
I was able to make many requests, and i used the pragma describe.strategy bidirectional, lie that
DESCRIBE http://medicis.univ-rennes1.fr/ontologies/ontospm/OntoMEDIRAD.owl#Patient_d20baee9-39b4-47fc-91c9-ad6a998869b5
But in some cases i receive an error :
org.openrdf.query.QueryEvaluationException: LongHashSet can't handle long element which equal to 0
at com.complexible.stardog.protocols.http.client.BaseHttpClient.checkResponseCode(BaseHttpClient.java:491)
at com.complexible.stardog.protocols.http.client.BaseHttpClient.execute(BaseHttpClient.java:363)
at com.complexible.stardog.protocols.http.client.HttpClientImpl.graph(HttpClientImpl.java:292)
at com.complexible.stardog.protocols.http.client.HttpConnection._graph(HttpConnection.java:158)
at com.complexible.stardog.api.impl.AbstractConnection.executeGraph(AbstractConnection.java:450)
at com.complexible.stardog.api.impl.GraphQueryImpl.execute(GraphQueryImpl.java:33)
at com.complexible.stardog.api.impl.GraphQueryImpl.execute(GraphQueryImpl.java:23)
at repository.RequestBuilder.describeRequest(RequestBuilder.java:298)