Swirrl / cubiql

CubiQL: A GraphQL service for querying multidimensional Linked Data Cubes
Eclipse Public License 1.0
41 stars 2 forks source link

Timeout exception when running at statistics.gov.scot #119

Closed zeginis closed 6 years ago

zeginis commented 6 years ago

@lkitching the query to get all the component has many OPTIONAL clauses. Most probably they cause the exception. We could can separate the SPARQL query to 1 query for measures and 1 for dimensions in order to remove the OPTIONAL. For the dimensions do we need the order?

Exception in thread "main" clojure.lang.ExceptionInfo: Error waiting on results {:prepared-query #object[org.openrdf.repository.sparql.query.SPARQLTupleQuery 0x198c57a "PREFIX qb: <http://purl.org/linked-data/cube#>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX skos: <http://www.w3.org/2004/02/skos/core#>PREFIX dcterms: <http://purl.org/dc/terms/>SELECT * WHERE {  ?ds qb:structure ?dsd .  ?dsd a qb:DataStructureDefinition .  ?dsd qb:component ?comp .  OPTIONAL { ?comp qb:order ?order }  OPTIONAL { ?comp qb:dimension ?dim }  OPTIONAL { ?dim qb:codeList ?codelist }  OPTIONAL { ?comp qb:measure ?measure }}"]}, compiling:(C:\Users\user\AppData\Local\Temp\form-init145695459187683163.clj:1:106)
    at clojure.lang.Compiler.load(Compiler.java:7526)
    at clojure.lang.Compiler.loadFile(Compiler.java:7452)
    at clojure.main$load_script.invokeStatic(main.clj:278)
    at clojure.main$init_opt.invokeStatic(main.clj:280)
    at clojure.main$init_opt.invoke(main.clj:280)
    at clojure.main$initialize.invokeStatic(main.clj:311)
    at clojure.main$null_opt.invokeStatic(main.clj:345)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.invokeStatic(main.clj:424)
    at clojure.main$main.doInvoke(main.clj:387)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:702)
    at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: Error waiting on results {:prepared-query #object[org.openrdf.repository.sparql.query.SPARQLTupleQuery 0x198c57a "PREFIX qb: <http://purl.org/linked-data/cube#>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX skos: <http://www.w3.org/2004/02/skos/core#>PREFIX dcterms: <http://purl.org/dc/terms/>SELECT * WHERE {  ?ds qb:structure ?dsd .  ?dsd a qb:DataStructureDefinition .  ?dsd qb:component ?comp .  OPTIONAL { ?comp qb:order ?order }  OPTIONAL { ?comp qb:dimension ?dim }  OPTIONAL { ?dim qb:codeList ?codelist }  OPTIONAL { ?comp qb:measure ?measure }}"]}
    at clojure.core$ex_info.invokeStatic(core.clj:4739)
    at clojure.core$ex_info.invoke(core.clj:4739)
    at grafter.rdf.repository$sesame_results__GT_seq$pull_query__5227.invoke(repository.clj:420)
    at grafter.rdf.repository$sesame_results__GT_seq$pull_query__5227$fn__5232.invoke(repository.clj:417)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:56)
    at clojure.lang.ChunkedCons.chunkedNext(ChunkedCons.java:59)
    at clojure.lang.ChunkedCons.next(ChunkedCons.java:43)
    at clojure.lang.RT.next(RT.java:706)
    at clojure.core$next__5108.invokeStatic(core.clj:64)
    at clojure.core$dorun.invokeStatic(core.clj:3134)
    at clojure.core$doall.invokeStatic(core.clj:3140)
    at clojure.core$doall.invoke(core.clj:3140)
    at graphql_qb.util$eager_query.invokeStatic(util.clj:75)
    at graphql_qb.util$eager_query.invoke(util.clj:70)
    at graphql_qb.dataset_model$get_all_components.invokeStatic(dataset_model.clj:103)
    at graphql_qb.dataset_model$get_all_components.invoke(dataset_model.clj:101)
    at graphql_qb.dataset_model$get_all_datasets.invokeStatic(dataset_model.clj:198)
    at graphql_qb.dataset_model$get_all_datasets.invoke(dataset_model.clj:189)
    at graphql_qb.core$build_schema_context.invokeStatic(core.clj:54)
    at graphql_qb.core$build_schema_context.invoke(core.clj:53)
    at graphql_qb.server$create_server.invokeStatic(server.clj:14)
    at graphql_qb.server$create_server.invoke(server.clj:12)
    at graphql_qb.server$start_server.invokeStatic(server.clj:25)
    at graphql_qb.server$start_server.invoke(server.clj:24)
    at graphql_qb.main$_main.invokeStatic(main.clj:55)
    at graphql_qb.main$_main.doInvoke(main.clj:44)
    at clojure.lang.RestFn.invoke(RestFn.java:482)
    at clojure.lang.Var.invoke(Var.java:403)
    at user$eval157.invokeStatic(form-init145695459187683163.clj:1)
    at user$eval157.invoke(form-init145695459187683163.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:7062)
    at clojure.lang.Compiler.eval(Compiler.java:7052)
    at clojure.lang.Compiler.eval(Compiler.java:7052)
    at clojure.lang.Compiler.load(Compiler.java:7514)
    ... 12 more
Caused by: org.openrdf.query.QueryEvaluationException: org.apache.http.MalformedChunkCodingException: Unexpected content at the end of chunk
    at org.openrdf.http.client.QueueCursor.checkException(QueueCursor.java:170)
    at org.openrdf.http.client.QueueCursor.getNextElement(QueueCursor.java:125)
    at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:91)
    at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:60)
    at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:68)
    at grafter.rdf.repository$sesame_results__GT_seq$pull_query__5227.invoke(repository.clj:409)
    ... 44 more
Caused by: org.apache.http.MalformedChunkCodingException: Unexpected content at the end of chunk
    at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:259)
    at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:227)
    at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:186)
    at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:215)
    at org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:316)
    at org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:128)
    at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
    at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174)
    at java.io.BufferedInputStream.close(BufferedInputStream.java:483)
    at java.io.FilterInputStream.close(FilterInputStream.java:181)
    at info.aduna.io.UncloseableInputStream.doClose(UncloseableInputStream.java:45)
    at org.openrdf.query.resultio.sparqlxml.SPARQLXMLParserBase.parseQueryResultInternal(SPARQLXMLParserBase.java:155)
    at org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLParser.parseQueryResult(SPARQLResultsXMLParser.java:84)
    at org.openrdf.http.client.BackgroundTupleResult.run(BackgroundTupleResult.java:102)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)