# Internal server error with reasoning queries and slow reasoning issue

**URL:** <https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215>\
**Category:** Support\
**Created:** [March 31, 2017, 11:53am UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215 "2017-03-31T11:53:57Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfwei1992](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jfwei1992](https://community.stardog.com/u/jfwei1992)\
**Post date:** [March 31, 2017, 11:53am UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/1 "2017-03-31T11:53:57Z")

</div>

Hi all,   
Just wondering if Stardog does not support reasoning queries with rdfs:label? It simply showed me Internal Server Error. I checked the log where I found it gave me following error while querying rdfs:label:

> ERROR 2017-03-31 12:31:40,129 [StardogServer.WorkerGroup-0] com.complexible.stardog.protocols.http.server.HttpMessageEncoder:write(171): There was an error writing the HTTP response org.openrdf.query.QueryEvaluationException: java.util.NoSuchElementException at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:81) ~[stardog-utils-rdf-4.2.3.jar:?] at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?] at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?] at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?] at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?] at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$2.encode(ResponseBodyEncoders.java:101) ~[stardog-protocols-http-server-4.2.3.jar:?] at com.complexible.stardog.protocols.http.annex.QueryPanelEncoder.encode(QueryPanelEncoder.java:112) ~[stardog-webconsole-annex-4.2.3.jar:?] at com.complexible.stardog.protocols.http.server.HttpMessageEncoder.write(HttpMessageEncoder.java:158) [stardog-protocols-http-server-4.2.3.jar:?] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633) [netty-all-4.0.32.Final.jar:4.0.32.Final] at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32) [netty-all-4.0.32.Final.jar:4.0.32.Final] at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908) [netty-all-4.0.32.Final.jar:4.0.32.Final] at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893) [netty-all-4.0.32.Final.jar:4.0.32.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) [netty-all-4.0.32.Final.jar:4.0.32.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-all-4.0.32.Final.jar:4.0.32.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.32.Final.jar:4.0.32.Final] at java.lang.Thread.run(Unknown Source) [?:1.8.0\_121] Caused by: java.util.NoSuchElementException at com.google.common.collect.AbstractIterator.next(AbstractIterator.java:154) ~[guava-18.0.jar:?] at com.google.common.collect.Iterators.find(Iterators.java:717) ~[guava-18.0.jar:?] at com.google.common.collect.Iterables.find(Iterables.java:646) ~[guava-18.0.jar:?] at com.clarkparsia.pellet.api.query.impl.DefaultQueryEngine.execute(DefaultQueryEngine.java:205) ~[stardog-reasoning-shared-4.2.3.jar:?] at com.clarkparsia.pellet.api.query.impl.DefaultQueryEngine.execute(DefaultQueryEngine.java:104) ~[stardog-reasoning-shared-4.2.3.jar:?] at com.clarkparsia.pellet.api.query.impl.DefaultQueryEngine.execute(DefaultQueryEngine.java:87) ~[stardog-reasoning-shared-4.2.3.jar:?] at com.clarkparsia.pellet.api.query.impl.AbstractQueryEngine.visit(AbstractQueryEngine.java:104) ~[stardog-reasoning-shared-4.2.3.jar:?] at com.clarkparsia.pellet.api.query.impl.AbstractQueryEngine.visit(AbstractQueryEngine.java:33) ~[stardog-reasoning-shared-4.2.3.jar:?] at com.clarkparsia.pellet.api.query.impl.SelectQueryImpl.accept(SelectQueryImpl.java:43) ~[stardog-reasoning-shared-4.2.3.jar:?] at com.clarkparsia.pellet.api.query.impl.AbstractQueryEngine.execute(AbstractQueryEngine.java:42) ~[stardog-reasoning-shared-4.2.3.jar:?] at com.complexible.stardog.reasoning.pellet.PelletUtils.executeQuery(PelletUtils.java:88) ~[stardog-reasoning-core-4.2.3.jar:?] at com.complexible.stardog.reasoning.pellet.PelletOp.computeNext(PelletOp.java:84) ~[stardog-reasoning-core-4.2.3.jar:?] at com.complexible.stardog.reasoning.pellet.PelletOp.computeNext(PelletOp.java:35) ~[stardog-reasoning-core-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:83) ~[stardog-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:33) ~[stardog-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.OrderLimitOffset.sortedResults(OrderLimitOffset.java:163) ~[stardog-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.OrderLimitOffset.computeNext(OrderLimitOffset.java:136) ~[stardog-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.OrderLimitOffset.computeNext(OrderLimitOffset.java:47) ~[stardog-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.SliceOp.\_hasNext(SliceOp.java:87) ~[stardog-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:95) ~[stardog-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:26) ~[stardog-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:115) ~[stardog-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:25) ~[stardog-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:110) ~[stardog-4.2.3.jar:?] at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:34) ~[stardog-4.2.3.jar:?] at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) ~[guava-18.0.jar:?] at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) ~[guava-18.0.jar:?] at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:77) ~[stardog-utils-rdf-4.2.3.jar:?] ... 15 more

Another issue is slowing reasoning query with IRIs. It happens when I run reasoning query with IRIs, where it takes up to 2 mins or even more. Is it normal or potentially faulty with my ontology?   
Thanks!

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [March 31, 2017, 1:11pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/2 "2017-03-31T13:11:57Z")

</div>

I’m not quite sure what you mean by “reasining query with IRI’s” but I might be able to help you get your question answered more quickly. Can you share your queries and data or at least a minimal example that reproduces your problem?

---

<div class="post-metadata">

**Author:** ![jfwei1992](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jfwei1992](https://community.stardog.com/u/jfwei1992)\
**Post date:** [March 31, 2017, 1:38pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/3 "2017-03-31T13:38:18Z")

</div>

Hi Zachary,   
Thanks for your reply. If I switch on reasoning while querying things without rdfs:label (where stardog returns links/IRIs), it works, as shown in the picture:

 ![](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/d625db89e17672b3fa884b95a9dae452c26df6cc.png)  
However, as I dricribed, it takes lots of time. So I am wondering if it is normal to take over a minute or more to run a reasoning query?

Another issue is if I query rdfs:label, such as

> Select ?s ?o WHERE{ ?s rdfs:label ?o}

Stardog complains with Internal Server Error. Is this normal? Sorry I was going to attach an screen shot but I am not allowed.

Thanks!

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [March 31, 2017, 1:56pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/4 "2017-03-31T13:56:36Z")

</div>

So you get a stack trace when you include rdfs:label and reasoning but don’t get the stack trace when you remove rdfs:label? In addition you feel like running the query with reasoning takes an excessive amount of time to complete? Do I have that right?

It’s difficult to say what is normal since query time is going to depend on a combination of, among other things, the data, ontology, query, and the hardware you’re running it on.

An internal server error is never something you should expect to see and it seems like there may be an issue.

---

<div class="post-metadata">

**Author:** ![jfwei1992](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jfwei1992](https://community.stardog.com/u/jfwei1992)\
**Post date:** [April 1, 2017, 8:32am UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/5 "2017-04-01T08:32:50Z")

</div>

> [@zachary.whitley](#):
>
> So you get a stack trace when you include rdfs:label and reasoning but don't get the stack trace when you remove rdfs:label?

Yes. It seems that as long as I include rdfs:label in my SPARQL query, it does not support query with reasoning.

> [@zachary.whitley](#):
>
> In addition you feel like running the query with reasoning takes an excessive amount of time to complete?

And yes again. Could it be possible that my ontology has some potential faults, even though it could do reasoning in Protoge? I reckon the hardware shouldn't be the problem- dual core processor and 8GB RAM are allocated to the virtual machine.

> [@zachary.whitley](#):
>
> An internal server error is never something you should expect to see and it seems like there may be an issue.

I do not know if Stardog doesn't support rdfs:label query with reasoning or?

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [April 3, 2017, 11:49am UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/6 "2017-04-03T11:49:52Z")

</div>

Hi,

It should be showing you an error for this, but try running the query without all of the `PREFIX` definitions in the textbox. The web console has a separate control above the textbox for defining prefixes, and it doesn’t like them being defined again.

That said, with a clean 4.2.4 install I am able to use reasoning in queries that contain `rdfs:label` just fine. If you could send us a small dataset and a query that reliably reproduce this issue, I’ll gladly take a look at it.

---

<div class="post-metadata">

**Author:** ![jfwei1992](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jfwei1992](https://community.stardog.com/u/jfwei1992)\
**Post date:** [April 3, 2017, 12:03pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/7 "2017-04-03T12:03:09Z")

</div>

Hi,

I am aware of the fact that PREFIX definitions should not be defined again so I left the separate control blank, otherwise it would notice me that I should not re-define prefix.

And thank you in advance! I am new to this community, so can you tell me how to send you the dataset? I cannot even execute the simplest one with reasoning like

> Select ?s ?o WHERE{ ?s rdfs:label ?o}

But it works fine without reasoning. Thank you!

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [April 3, 2017, 12:25pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/8 "2017-04-03T12:25:04Z")

</div>

As far as sending the dataset, if you are unable to put it here as an attachment, you could try a service like refheap or pastebin and make it private.

But all that aside, does your query work if you try it via the CLI instead of the webconsole? i.e., `stardog query -r myDb "select ?s ?o where {?s rdfs:label ?o}"`?

---

<div class="post-metadata">

**Author:** ![jfwei1992](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jfwei1992](https://community.stardog.com/u/jfwei1992)\
**Post date:** [April 3, 2017, 12:39pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/9 "2017-04-03T12:39:22Z")

</div>

I tried it and it showed me this

 ![](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/c7d5ef45da577af1e8d3a39ef3e02d5860d3f855.png)  
[Ontology file](https://raw.githubusercontent.com/Jinwei92/Scalability/master/SSO.ttl?token=AWakXV1ZIKn9K9hmmN9_RNr3Z8_RFje-ks5Y63y_wA%3D%3D)

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [April 3, 2017, 6:10pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/10 "2017-04-03T18:10:38Z")

</div>

Hi,

After looking into this issue further, it is actually a bug in our DL reasoning. Were your ontology an SL (RL, EL, QL) ontology, you wouldn’t be seeing this.

Thanks for the report! I’ve filed a bug internally, we’ll continue looking at it and report back here with any news or workarounds. As a temporary workaround for this, you could use a different predicate. For example:

```auto
INSERT {?s :myTempRdfsLabel ?o} WHERE {BIND(rdfs:label as ?p) . ?s ?p ?o}

```

This would let you query on your temp variable for the same results without having to rely specifically on `rdfs:label`.

---

<div class="post-metadata">

**Author:** ![jfwei1992](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jfwei1992](https://community.stardog.com/u/jfwei1992)\
**Post date:** [April 5, 2017, 10:13am UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/11 "2017-04-05T10:13:05Z")

</div>

Hi,

Thanks for your reply! Is it going to be fixed in the future or it has been fixed in 4.2.4? Currently, I am still running 4.2.3.

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [April 5, 2017, 11:27am UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/12 "2017-04-05T11:27:45Z")

</div>

No, it is not fixed as of 4.2.4. The fix will roll out sometime during the 5.x lifecycle.

---

<div class="post-metadata">

**Author:** ![jfwei1992](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jfwei1992](https://community.stardog.com/u/jfwei1992)\
**Post date:** [April 5, 2017, 2:28pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/13 "2017-04-05T14:28:57Z")

</div>

I see. Thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [April 19, 2017, 2:29pm UTC](https://community.stardog.com/t/internal-server-error-with-reasoning-queries-and-slow-reasoning-issue/215/14 "2017-04-19T14:29:13Z")

</div>

Closed on April 19, 2017, 2:29pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
