All,
I've created a simple servlet to be able to get RDF/XML-ABBREV formatted
results for parts of my application, which depends on that syntax.
It works fine for trivial DESCRIBEs (i.e. just DESCRIBE a single URI), but for
slightly more complex queries, I get this error:
com.hp.hpl.jena.shared.JenaException: Convert results are
FAILED.:virtuoso.jdbc3.VirtuosoException: Bad column number : 2 not in 1<n<1
virtuoso.jena.driver.VirtuosoQueryExecution.execDescribe(Unknown Source)
virtuoso.jena.driver.VirtuosoQueryExecution.execDescribe(Unknown Source)
com.computas.sublima.query.servlets.VirtJenaEndpoint.doGet(VirtJenaEndpoint.java:41)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
com.computas.sublima.app.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:24)
An example of a query is this:
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX wdr: <http://www.w3.org/2007/05/powder#>
DESCRIBE ?resource
<http://xmlns.computas.com/topic/topic000273> ?publisher ?subjects ?rest
WHERE {
?resource dct:language ?lang;
dct:publisher ?publisher ;
dct:subject
<http://xmlns.computas.com/topic/topic000273>, ?subjects ;
wdr:describedBy
<http://sublima.computas.com/status/godkjent_av_administrator> ;
?p ?rest .}
If I run this through the Virtuoso SPARQL Endpoint, it returns the correct
results, but crashes if I run it through Jena. The core of my servlet code is
this:
VirtGraph vGraph = new VirtGraph(
SettingsService.getProperty("sublima.database.url"),
SettingsService.getProperty("sublima.database.username"),
SettingsService.getProperty("sublima.database.password")
);
Query sparql = null;
try {
sparql = QueryFactory.create(req.getParameterValues("query")[0]);
} catch (QueryException e) {
res.sendError(400, "The SPARQL query was malformed: " +
e.getMessage());
e.printStackTrace();
return;
}
VirtuosoQueryExecution exec =
VirtuosoQueryExecutionFactory.create(sparql, vGraph);
Model model = exec.execDescribe();
res.setContentType("application/rdf+xml");
PrintWriter out = res.getWriter();
model.write(out, "RDF/XML-ABBREV");
out.close();
The exception message doesn't mean much to me, can anybody give more details
about what this means?
Kind regards
Kjetil Kjernsmo
--
Senior Knowledge Engineer
Mobile: +47 986 48 234
Email: [email protected]
Web: http://www.computas.com/
| SHARE YOUR KNOWLEDGE |
Computas AS PO Box 482, N-1327 Lysaker | Phone:+47 6783 1000 | Fax:+47 6783
1001