Errors happening in v6 but not in v5 (PropertyChainAxioms?)

I have recently installed version 6 and have adapted my code from version 5 to follow the new changes.

However, my program (which runs just fine in version 5) is suddenly raising errors in v6 when I execute certain queries. I double checked in the (now discontinued) Web console that the error is happening, just in case it was something wrong with my code aiming v6, and it also says "Error! Internal Server Error".

One situation I found where this happens is when reasoning is used in some queries. For example, if I explicitly query for an element in a specific class:

SELECT ?s
WHERE {
   ex:book1 a ex:Book
}

For some reason, version 6 doesn't like this, whereas v5 just worked. On the contrary, I get no error without reasoning, or when I query no specific individual ?s a ex:Book or when I query a specific individual of another class ex:author1 a ex:Author.

I did many tests and it seems that this (Protege notation) property chain is not liked:
isFriendOf o likesBook -> likesBook
Range of likesBook is Book. This is seen in Stardog as PropertyChainAxiom with bnode_... with First and Rest. Maybe this is the reason?

How can I research the source of the problem? The logs are not very clear.

The error I get:

com.stardog.stark.query.QueryExecutionFailure: Server Error, check logs for details
at com.complexible.stardog.protocols.http.client.BaseHttpClient.checkResponseCode(BaseHttpClient.java:492)
at com.complexible.stardog.protocols.http.client.BaseHttpClient.execute(BaseHttpClient.java:364)
at com.complexible.stardog.protocols.http.client.HttpClientImpl.select(HttpClientImpl.java:187)
at com.complexible.stardog.protocols.http.client.HttpConnection._select(HttpConnection.java:233)
at com.complexible.stardog.api.impl.AbstractConnection.executeSelect(AbstractConnection.java:435)
at com.complexible.stardog.api.impl.SelectQueryImpl.execute(SelectQueryImpl.java:37)
at com.complexible.stardog.api.impl.SelectQueryImpl.execute(SelectQueryImpl.java:24)

I like that v5 just gave you the error without having to check the log file. And checking the log file:

com.stardog.stark.query.QueryExecutionFailure: null
        at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:82) ~[stardog-utils-rdf-6.1.2.jar:?]
        at com.stardog.stark.query.ClosingSpliterator.forEachRemaining(ClosingSpliterator.java:37) ~[stardog-stark-query-api-6.1.2.jar:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[?:1.8.0_66-internal]
        at com.stardog.stark.query.io.QueryResultWriters.write(QueryResultWriters.java:142) ~[stardog-stark-query-io-6.1.2.jar:?]
        at com.stardog.stark.query.io.QueryResultWriters.write(QueryResultWriters.java:127) ~[stardog-stark-query-io-6.1.2.jar:?]
        at com.complexible.stardog.protocols.http.server.ProtocolUtils.writeTupleResponse(ProtocolUtils.java:579) ~[stardog-protocols-http-server-6.1.2.jar:?]
        at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:489) ~[stardog-protocols-http-server-6.1.2.jar:?]
        at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:474) ~[stardog-protocols-http-server-6.1.2.jar:?]
        at com.complexible.stardog.protocols.http.server.SPARQLProtocol.executeQuery(SPARQLProtocol.java:127) ~[stardog-protocols-http-server-6.1.2.jar:?]
        at com.complexible.stardog.protocols.http.server.SPARQLProtocol.get(SPARQLProtocol.java:82) ~[stardog-protocols-http-server-6.1.2.jar:?]
        at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-6.1.2.jar:?]
        at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.2.3.jar:1.2.3]
        at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.2.3.jar:1.2.3]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_66-internal]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_66-internal]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66-internal]
Caused by: java.lang.IllegalArgumentException
        at com.complexible.stardog.plan.filter.expr.ValueOrError$TypeError.value(ValueOrError.java:53) ~[stardog-6.1.2.jar:?]
.... (long)

The syntax for property chains is correct and should not be the problem. The v6 will return errors same way as v5 except when the error/exception is not caught in the code you get a very generic messages like that. The rest of the exception might actually give us a clue what is going wrong as well as the query plan with reasoning. But it'd be best if you can share a minimal example to reproduce the problem.

Best,
Evren

I am trying to create a minimal example and I'll get back to you.

While I try to isolate the problem (it seems to fail only on specific sets of data), does the full log can give me any clue about where I should look?

ERROR 2019-06-06 10:37:29,824 [stardog-user-16] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(235): An unexpected exception was handled by the server
com.stardog.stark.query.QueryExecutionFailure: null
	at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:82) ~[stardog-utils-rdf-6.1.2.jar:?]
	at com.stardog.stark.query.ClosingSpliterator.forEachRemaining(ClosingSpliterator.java:37) ~[stardog-stark-query-api-6.1.2.jar:?]
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[?:1.8.0_66-internal]
	at com.stardog.stark.query.io.QueryResultWriters.write(QueryResultWriters.java:142) ~[stardog-stark-query-io-6.1.2.jar:?]
	at com.stardog.stark.query.io.QueryResultWriters.write(QueryResultWriters.java:127) ~[stardog-stark-query-io-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.writeTupleResponse(ProtocolUtils.java:579) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:489) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:474) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.SPARQLProtocol.executeQuery(SPARQLProtocol.java:127) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.SPARQLProtocol.get(SPARQLProtocol.java:82) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.2.3.jar:1.2.3]
	at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.2.3.jar:1.2.3]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_66-internal]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_66-internal]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66-internal]
Caused by: java.lang.IllegalArgumentException
	at com.complexible.stardog.plan.filter.expr.ValueOrError$TypeError.value(ValueOrError.java:53) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.CanonicalConstantMap.canonicalURI(CanonicalConstantMap.java:54) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.CanonicalConstantMap.apply(CanonicalConstantMap.java:77) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.CanonicalConstantMap.apply(CanonicalConstantMap.java:31) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.lambda$new$0(ReplaceConstantsNodeVisitor.java:80) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.replace(ReplaceConstantsNodeVisitor.java:86) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.replaceScanConstants(ReplaceConstantsNodeVisitor.java:256) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.transform(ReplaceConstantsNodeVisitor.java:189) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.transform(ReplaceConstantsNodeVisitor.java:46) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:855) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.ScanNodeImpl.accept(ScanNodeImpl.java:175) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:72) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.lambda$transform$2(TransformingPlanNodeVisitor.java:298) ~[stardog-6.1.2.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_66-internal]
	at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_66-internal]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_66-internal]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_66-internal]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_66-internal]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_66-internal]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:298) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:863) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:120) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:72) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.transform(ReplaceConstantsNodeVisitor.java:154) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.transform(ReplaceConstantsNodeVisitor.java:46) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:967) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.PropertyPathPlanNodeImpl.accept(PropertyPathPlanNodeImpl.java:173) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:72) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.lambda$transform$2(TransformingPlanNodeVisitor.java:298) ~[stardog-6.1.2.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_66-internal]
	at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_66-internal]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_66-internal]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_66-internal]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_66-internal]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_66-internal]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:298) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:863) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:120) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryVisit(TransformingPlanNodeVisitor.java:673) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.transform(ReplaceConstantsNodeVisitor.java:222) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.ReplaceConstantsNodeVisitor.transform(ReplaceConstantsNodeVisitor.java:46) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:927) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.BindPlanNodeImpl.accept(BindPlanNodeImpl.java:130) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.binaryVisit(TransformingPlanNodeVisitor.java:690) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.binaryTransform(TransformingPlanNodeVisitor.java:95) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:138) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:887) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.UnionPlanNodeImpl.accept(UnionPlanNodeImpl.java:88) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:72) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.lambda$transform$2(TransformingPlanNodeVisitor.java:298) ~[stardog-6.1.2.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_66-internal]
	at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_66-internal]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_66-internal]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_66-internal]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_66-internal]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_66-internal]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_66-internal]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:298) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:863) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:120) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:72) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.SimplePlanCache$PlanCacheContext.<init>(SimplePlanCache.java:211) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.cache.SimplePlanCache.get(SimplePlanCache.java:91) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.VariableReplacementSolutionTable.optimize(VariableReplacementSolutionTable.java:162) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.VariableReplacementSolutionTable.replaceVariables(VariableReplacementSolutionTable.java:156) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.VariableReplacementSolutionTable.compatibleWith(VariableReplacementSolutionTable.java:215) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.SolutionTable.lookup(SolutionTable.java:43) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.HashJoinOp._nextLeft(HashJoinOp.java:221) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.HashJoinOp.computeNext(HashJoinOp.java:160) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.HashJoinOp.computeNext(HashJoinOp.java:32) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at java.util.Iterator.forEachRemaining(Iterator.java:115) ~[?:1.8.0_66-internal]
	at com.complexible.stardog.plan.eval.operator.impl.SortOp.init(SortOp.java:109) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SortOp.computeNext(SortOp.java:79) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SortOp.computeNext(SortOp.java:30) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp._init(MergeJoinOp.java:326) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:243) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LoopJoin.nextLeft(LoopJoin.java:128) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LoopJoin.computeNext(LoopJoin.java:176) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LoopJoin.computeNext(LoopJoin.java:25) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp._init(MergeJoinOp.java:326) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:243) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp._init(MergeJoinOp.java:326) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:243) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp._init(MergeJoinOp.java:326) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:243) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp._init(MergeJoinOp.java:326) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:243) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LoopJoin.nextLeft(LoopJoin.java:128) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LoopJoin.computeNext(LoopJoin.java:176) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LoopJoin.computeNext(LoopJoin.java:25) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp._init(MergeJoinOp.java:326) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:243) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp._init(MergeJoinOp.java:326) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:243) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.MergeJoinOp.computeNext(MergeJoinOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.BindOp.computeNext(BindOp.java:158) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.BindOp.computeNext(BindOp.java:39) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at java.util.Iterator.forEachRemaining(Iterator.java:115) ~[?:1.8.0_66-internal]
	at com.complexible.stardog.plan.eval.operator.impl.OrderOp.sort(OrderOp.java:149) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.OrderOp.computeNext(OrderOp.java:136) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.OrderOp.computeNext(OrderOp.java:30) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.BindOp.computeNext(BindOp.java:158) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.BindOp.computeNext(BindOp.java:39) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:82) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LazyUnsortedGroupify$1.computeNext(GroupifyAlgorithms.java:160) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.LazyUnsortedGroupify$1.computeNext(GroupifyAlgorithms.java:151) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.AbstractGroupOp.computeNext(AbstractGroupOp.java:132) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.AbstractGroupOp.computeNext(AbstractGroupOp.java:31) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.DistinctOp.computeNext(DistinctOp.java:53) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.DistinctOp.computeNext(DistinctOp.java:21) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:112) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:25) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:116) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:39) ~[stardog-6.1.2.jar:?]
	at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:141) ~[guava-26.0-jre.jar:?]
	at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:136) ~[guava-26.0-jre.jar:?]
	at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:78) ~[stardog-utils-rdf-6.1.2.jar:?]
	... 15 more

The query plans are these:

Query:

SELECT distinct ?s WHERE { ?s ex:likesBook example:book275 }

No reasoning:

The Query Plan:

From all
Distinct [#11]
`─ Projection(?s) [#12]
─ Scan[POSC](?s, http://www.ex.com/d#likesBook, http://www.example.com/d#book275) [#12]

Reasoning:

The Query Plan:

From all
Distinct [#44]
`─ Projection(?s) [#44]
   `─ BindJoin(?rdjynntx) [#44]
      +─ Scan[POSC](?rdjynntx, <http://www.ex.com/d#likesBook>, <http://www.example.com/d#book275>) [#12]
      `─ Union [#421K]
         +─ PropertyPath(?s -> ?rdjynntx, minLength=1, sorted by=?s) [#4.1K]
         │  `─ Scan[PSOC](?s, <http://www.ex.com/d#isFriendOf>, ?rdjynntx) [#2.1K]
         `─ PropertyPath(?s -> ?rdjynntx, minLength=0) [#417K]
            `─ Empty [#1]

The amount of data is very small, not sure how the #421K is calculated. I was suspecting this can be the reason, but I also got the error on an almost empty dataset in my tests.

Thanks, this log already gives us some food for thought, we'll respond here once we know more.

Are you sure you get this stack trace for the plan with reasoning that you show in the previous message? It looks like the trace should be for a different, a bit more complex plan.

Are you able to share your data so we'd reproduce it on our end?

Thanks,
Pavel

Yes, I am positive. Those are the answers I got with the commands:

/home/nere/stardog-6.1.2/bin/stardog query explain mydb "SELECT distinct ?s WHERE { ?s ex:likesBook example:book275 }"

and

/home/nere/stardog-6.1.2/bin/stardog query explain mydb "SELECT distinct ?s WHERE { ?s ex:likesBook example:book275 }" --reasoning

I will try to get some valid data for you to reproduce it. While trying to get it, I realised something that might raise some light on why the exception happens (although not on what it triggers it). I just realised that I installed an old 6.1.2 download that was marked as "Community", so perhaps that is why the error happens. I mention it because there are some times where the error happens (if I have around ~390k triples in the database), but then I remove a single unrelated triple and the error is not raised anymore. I am still not sure why in such a small dataset it could overpass any limit... And I also recall I got the same error even with an almost empty dataset (probably less than 500 triples). If I remove the chain, the inference is not done but no error happens (as expected, since it is the same result as not using reasoning).

No, Community doesn't have anything to do with it.

The reason I believe the stacktrace is for some other query is that there're operators in it, e.g. ORDER BY, which are not in your plan. Perhaps you could delete the server's log, restart the server, and run just this query to make sure the log does not contain any traces from other queries.

Of course if you could share some data, that would be just ideal. Thanks.

Thanks for the info. I thought of the CE because I isolated the data set in a way that Stardog gives me an error as soon as I add one (unrelated) triple. I remove it and I get no error again. So it seemed like a sort of "data size" error.

I am trying to generate a minimum file that works. I will keep this thread open so (hopefully) I can send something soon.