[
https://issues.apache.org/jira/browse/JENA-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andy Seaborne updated JENA-1116:
--------------------------------
Issue Type: Question (was: Bug)
> Does Jena 2.7.x support compressed chunked results from SPARQL endpoints
> -------------------------------------------------------------------------
>
> Key: JENA-1116
> URL: https://issues.apache.org/jira/browse/JENA-1116
> Project: Apache Jena
> Issue Type: Question
> Components: Jena
> Affects Versions: Jena 2.7.4
> Environment: Any ...
> Reporter: Hugh Williams
>
> Consider the following sample code:
> {noformat}
> $ cat VirtuosoTestMalformedInput.java
> import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP;
> /**
> * Created by kosterar on 2015-11-25.
> */
> public class VirtuosoTestMalformedInput {
> public static final String SPARQL_ENDPOINT =
> "http://demo.openlinksw.com/sparql";
> public static final String QUERY = "SELECT ?p where { <${s}> ?p ?o.}";
> public static void main(String... args) {
> test();
> }
> public static void test() {
> final QueryEngineHTTP queryEngine = new
> QueryEngineHTTP(SPARQL_ENDPOINT, QUERY);
> queryEngine.execSelect();
> }
> }
> $
> {noformat}
> Which queries a Virtuoso SPARQL endpoint with a deliberate bad query,
> expected to return a Virtuoso error. The Virtuoso SPARQL endpoint sends
> results in compressed (gzipped) chunks by default (EnabledGzipContent = 1 set
> in the HTTP Server section of the Virtuoso config file by default).
> When the above query is run one expects the error "SP030 SPARQL compiler,
> line 0: Bad character '$' (0x24)
> in SPARQL expression at '$'" to be returned:
> {noformat}
> $ curl -g -H 'Accept:
> application/json'
> 'http://demo.openinksw.com/sparql?query=SELECT%20%3Fp%20where%20%7B%20%3C%24%7Bs%7D%3E%20%3Fp%20%3Fo.%7D'
> Virtuoso 37000 Error SP030: SPARQL compiler, line 0: Bad character '$' (0x24)
> in SPARQL expression at '$'
> SPARQL query:
> define sql:big-data-const 0 SELECT ?p where { <${s}> ?p ?o.}
> $
> {noformat}
> but instead Jena gives the error:
> {noformat}
> $ javac -classpath
> ".:../apache-jena-2.7.4/lib/commons-codec-1.5.jar:../apache-jena-2.7.4/lib/httpclient-4.1.2.jar:../apache-jena-2.7.4/lib/httpcore-4.1.3.jar:../apache-jena-2.7.4/lib/jcl-over-slf4j-1.6.4.jar:../apache-jena-2.7.4/lib/jena-arq-2.9.4.jar:../apache-jena-2.7.4/lib/jena-core-2.7.4.jar:../apache-jena-2.7.4/lib/jena-iri-0.9.4.jar:../apache-jena-2.7.4/lib/jena-tdb-0.9.4.jar:../apache-jena-2.7.4/lib/log4j-1.2.16.jar:../apache-jena-2.7.4/lib/slf4j-api-1.6.4.jar:../apache-jena-2.7.4/lib/slf4j-log4j12-1.6.4.jar:../apache-jena-2.7.4/lib/xercesImpl-2.10.0.jar:../apache-jena-2.7.4/lib/xml-apis-1.4.01.jar"
> VirtuosoTestMalformedInput.java
> $ java -classpath
> ".:../apache-jena-2.7.4/lib/commons-codec-1.5.jar:../apache-jena-2.7.4/lib/httpclient-4.1.2.jar:../apache-jena-2.7.4/lib/httpcore-4.1.3.jar:../apache-jena-2.7.4/lib/jcl-over-slf4j-1.6.4.jar:../apache-jena-2.7.4/lib/jena-arq-2.9.4.jar:../apache-jena-2.7.4/lib/jena-core-2.7.4.jar:../apache-jena-2.7.4/lib/jena-iri-0.9.4.jar:../apache-jena-2.7.4/lib/jena-tdb-0.9.4.jar:../apache-jena-2.7.4/lib/log4j-1.2.16.jar:../apache-jena-2.7.4/lib/slf4j-api-1.6.4.jar:../apache-jena-2.7.4/lib/slf4j-log4j12-1.6.4.jar:../apache-jena-2.7.4/lib/xercesImpl-2.10.0.jar:../apache-jena-2.7.4/lib/xml-apis-1.4.01.jar"
> VirtuosoTestMalformedInput
> log4j:WARN No appenders could be found for logger
> (com.hp.hpl.jena.sparql.mgt.ARQMgt).
> log4j:WARN Please initialize the log4j system properly.
> Exception in thread "main" HttpException:
> java.nio.charset.MalformedInputException: Input length = 1:
> java.nio.charset.MalformedInputException: Input length = 1
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:520)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:289)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:240)
> at
> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:213)
> at VirtuosoTestMalformedInput.test(VirtuosoTestMalformedInput.java:21)
> at VirtuosoTestMalformedInput.main(VirtuosoTestMalformedInput.java:15)
> Caused by: java.nio.charset.MalformedInputException: Input length = 1
> at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
> at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
> at java.io.InputStreamReader.read(InputStreamReader.java:184)
> at java.io.BufferedReader.read1(BufferedReader.java:210)
> at java.io.BufferedReader.read(BufferedReader.java:286)
> at java.io.Reader.read(Reader.java:140)
> at
> com.hp.hpl.jena.util.FileUtils.readWholeFileAsUTF8(FileUtils.java:460)
> at
> com.hp.hpl.jena.util.FileUtils.readWholeFileAsUTF8(FileUtils.java:444)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:433)
> ... 5 more
> $
> {noformat}
> Whereas if I set EnabledGzipContent = 0 set in Virtuoso INI file the expected
> error is returned:
> {noformat}
> $ java -classpath
> ".:../apache-jena-2.7.4/lib/commons-codec-1.5.jar:../apache-jena-2.7.4/lib/httpclient-4.1.2.jar:../apache-jena-2.7.4/lib/httpcore-4.1.3.jar:../apache-jena-2.7.4/lib/jcl-over-slf4j-1.6.4.jar:../apache-jena-2.7.4/lib/jena-arq-2.9.4.jar:../apache-jena-2.7.4/lib/jena-core-2.7.4.jar:../apache-jena-2.7.4/lib/jena-iri-0.9.4.jar:../apache-jena-2.7.4/lib/jena-tdb-0.9.4.jar:../apache-jena-2.7.4/lib/log4j-1.2.16.jar:../apache-jena-2.7.4/lib/slf4j-api-1.6.4.jar:../apache-jena-2.7.4/lib/slf4j-log4j12-1.6.4.jar:../apache-jena-2.7.4/lib/xercesImpl-2.10.0.jar:../apache-jena-2.7.4/lib/xml-apis-1.4.01.jar"
> VirtuosoTestMalformedInput
> log4j:WARN No appenders could be found for logger
> (com.hp.hpl.jena.sparql.mgt.ARQMgt).
> log4j:WARN Please initialize the log4j system properly.
> Exception in thread "main" HttpException: 400 Bad Request
> Virtuoso 37000 Error SP030: SPARQL compiler, line 0: Bad character '$' (0x24)
> in SPARQL expression at '$'
> SPARQL query:
> SELECT ?p where { <${s}> ?p ?o.}
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:434)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:289)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:240)
> at
> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:213)
> at VirtuosoTestMalformedInput.test(VirtuosoTestMalformedInput.java:21)
> at VirtuosoTestMalformedInput.main(VirtuosoTestMalformedInput.java:15)
> $
> {noformat}
> Hence the question as to whether Jena 2.7x supports compressed chunked data
> or is this possibly a bug ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)