Literal query with language tag fails when rdfs reasoning switched on (web interface)

I am working with the trial of the enterprise edition. I have loaded the snomed ct ontology and then run this sparql query without reasoning:

SELECT * WHERE {
?s ?p "Malaria"@en .
?s rdfs:subClassOf ?parent .
?parent skos:prefLabel ?name .
}

which successfully returns a single result. However the DB is configured to use rdfs reasoning and when I execute the same query with reasoning on it produces an error and this stacktrace:

ERROR 2017-12-07 12:04:35,293 [XNIO-1 task-4] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(231): An unexpected exception was handled by the server
org.openrdf.query.QueryEvaluationException: No separator character found in the URI: "Malaria"@en
	at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:81) ~[stardog-utils-rdf-5.0.5.1.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.ProtocolUtils.writeTupleResponse(ProtocolUtils.java:563) ~[stardog-protocols-http-server-5.0.5.1.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:470) ~[stardog-protocols-http-server-5.0.5.1.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.executeQuery(QueryPanelService.java:179) ~[stardog-webconsole-annex-5.0.5.1.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.post(QueryPanelService.java:120) ~[stardog-webconsole-annex-5.0.5.1.jar:?]
	at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-5.0.5.1.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 com.stardog.http.server.undertow.ErrorHandling.lambda$safeDispatch$1(ErrorHandling.java:71) ~[stardog-protocols-http-server-5.0.5.1.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]

Even worse, if I remove the language tag I get a stack overflow:

SELECT * WHERE {
?s ?p "Malaria" .
?s rdfs:subClassOf ?parent .
?parent skos:prefLabel ?name .
}

this stacktrace

com.stardog.http.server.undertow.ErrorHandling:writeError(180): Unexpected error on the server
java.lang.StackOverflowError: null
	at java.util.Iterator.forEachRemaining(Iterator.java:115) ~[?:1.8.0_144]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_144]
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[?:1.8.0_144]
	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) ~[?:1.8.0_144]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:1.8.0_144]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_144]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_144]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_144]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_144]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_144]
	at com.complexible.stardog.db.ConnectableConnectionCollection.getQueryRewritings(ConnectableConnectionCollection.java:154) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.db.DatabaseConnectionImpl.getQueryRewritings(DatabaseConnectionImpl.java:254) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.db.DelegatingConnectableConnection.getQueryRewritings(DelegatingConnectableConnection.java:84) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.db.DelegatingConnectableConnection.getQueryRewritings(DelegatingConnectableConnection.java:84) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.plan.cache.SimplePlanCache$PlanCacheContext.<init>(SimplePlanCache.java:215) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.plan.cache.SimplePlanCache.get(SimplePlanCache.java:94) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.plan.eval.ExecutablePlanFactory.createOptimized(ExecutablePlanFactory.java:102) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.plan.eval.ExecutionContext.executable(ExecutionContext.java:357) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.plan.eval.ExecutionContext.exec(ExecutionContext.java:331) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.plan.eval.ExecutionContext.exec(ExecutionContext.java:317) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.reasoning.blackout.PropertyOp.getSolutions(PropertyOp.java:94) ~[stardog-reasoning-core-5.0.5.1.jar:?]
	at com.complexible.stardog.reasoning.blackout.PropertyOp.lambda$getSolutions$0(PropertyOp.java:75) ~[stardog-reasoning-core-5.0.5.1.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_144]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_144]
	at java.util.HashMap$KeySpliterator.tryAdvance(HashMap.java:1569) ~[?:1.8.0_144]
	at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294) ~[?:1.8.0_144]
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206) ~[?:1.8.0_144]
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161) ~[?:1.8.0_144]
	at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300) ~[?:1.8.0_144]
	at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) ~[?:1.8.0_144]
	at com.complexible.common.base.Streams$1.computeNext(Streams.java:264) ~[stardog-utils-common-5.0.5.1.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.stardog.plan.eval.operator.SolutionIterator$2.hasNext(SolutionIterator.java:63) ~[stardog-5.0.5.1.jar:?]
	at com.complexible.stardog.reasoning.blackout.AbstractReasoningOperator.computeNext(AbstractReasoningOperator.java:131) ~[stardog-reasoning-core-5.0.5.1.jar:?]
	at com.complexible.stardog.reasoning.blackout.AbstractReasoningOperator.computeNext(AbstractReasoningOperator.java:142) ~[stardog-reasoning-core-5.0.5.1.jar:?]
	at com.complexible.stardog.reasoning.blackout.AbstractReasoningOperator.computeNext(AbstractReasoningOperator.java:142) ~[stardog-reasoning-core-5.0.5.1.jar:?]
	at com.complexible.stardog.reasoning.blackout.AbstractReasoningOperator.computeNext(AbstractReasoningOperator.java:142) ~[stardog-reasoning-core-5.0.5.1.jar:?]
	at 

I know that it should work because if I swap the string literal for the exact IRI the inference works

SELECT * WHERE {
<valid iri> rdfs:subClassOf ?parent .
?parent skos:prefLabel ?name .
}

anyone have any suggestions?

Thanks,

Sheldon

Hi, thanks for the detailed report!

We are able to reproduce this problem and I’ve opened an issue (#4539) to fix it in an upcoming release.