JENA:端点返回Content-Type:text/html [英] JENA: Endpoint returned Content-Type: text/html

查看:80
本文介绍了JENA:端点返回Content-Type:text/html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试向某个端点发送sparql查询时,例如:

When I try to send a sparql query to some endpoint, for example:

QueryExecution qe = QueryExecutionFactory.sparqlService("http://data.open.ac.uk/sparql",
                getStringForQuery());
        ResultSet results = qe.execSelect();

我知道

Exception in thread "main" org.apache.jena.query.QueryException: Endpoint returned Content-Type: text/html which is not currently supported for SELECT queries
    at org.apache.jena.sparql.engine.http.QueryEngineHTTP.execResultSetInner(QueryEngineHTTP.java:372)
    at org.apache.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:334)

这不是我无法向其发送查询的唯一一个端点,

And this is not the only one endpoint, to which I can't send query,

我应该怎么做才能得到其他内容类型的结果?我尝试用Google搜索它,但是我发现如果我将查询发送到错误的html(不是sparql端点),但是

What should I do to get results in other content-type? I try to google it, but I found that it can happen if I send query to bad html (not sparql endpoint), but http://data.open.ac.uk/sparql is good endpoint, I send sparql query to it via python and everything was good.

推荐答案

我不知道它们使用哪种后端,但是由于任何原因,在使用SPARQL端点时必须使用附加的HTTP参数force=true来自外部服务:

I don't know what kind of backend they use, but for whatever reason, you have to use an additional HTTP parameter force=true when using the SPARQL endpoint from external services:

http://data.open.ac.uk/sparql?force=true

根据Apache Jena开发团队的Andy Seaborne的说法,这应该是Jena 3.1.1重定向中的错误.在版本3.1.0中,重定向到?force=true的功能符合预期.另外,后端是Fuseki 2.3.1.

According to Andy Seaborne from the Apache Jena development team, this is supposed to be a bug in the redirect in Jena 3.1.1. In version 3.1.0 the redirect to ?force=true works as expected. In addition, the backend is Fuseki 2.3.1.

这篇关于JENA:端点返回Content-Type:text/html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆