Filter inside Optional error

Hi All,

I have been trying to run a query similar to:

PREFIX pref: urn:foo:bar:
SELECT *
FROM virtual://foobar_vg

WHERE{
?s a pref:Object.
FILTER EXISTS { { ?s pref:startTime ?startTimes }
UNION
{ ?s pref:endTime ?endTimes }
UNION
{ ?s pref:time ?times } }

OPTIONAL { ?s pref:startTime ?startTimes .
FILTER(StrDt(?startTimes, xsd:dateTime) >= "2017-07-25T00:00:00"^^xsd:dateTime).
FILTER(StrDt(?startTimes, xsd:dateTime)<= "2017-09-05T23:59:59"^^xsd:dateTime). }
}

for a while now. This results in the following error at the start of execution :

000012: com.complexible.stardog.plan.eval.ExecutionException: Unable to translate expression

The query executes if the FILTER statements are outside of the optional statement; however, that is not what I want to query.... Any ideas? According to https://www.w3.org/TR/rdf-sparql-query/#OptionalAndConstraints, the syntax seems okay.

Thanks,
Kevin

The syntax is OK indeed. What version of Stardog is this? We had a logging issue with 7.1 but later versions should put enough information in stardog.log located in your $STARDOG_HOME directory.

Best,
Pavel

I am using stardog 7.2.1 in a docker container for testing. I am also running the stardog studio container given here https://www.stardog.com/blog/introducing-stardog-studio-in-the-browser/

Cool. Could you share the log then?

I don't see stardog.log inside the docker container. It is neither the working directory or the STARDOG_HOME directory. I'm guessing it should be there

Should the log file be there on startup or is it the error logs generated from a bad query?

The log file should be created in $STARDOG_HOME on startup.

Here it is on startup:

INFO 2020-04-27 15:00:01,305 [main] com.complexible.stardog.cli.impl.ServerStart:call(243): Memory options
INFO 2020-04-27 15:00:01,305 [main] com.complexible.stardog.cli.impl.ServerStart:call(244): Memory mode: DEFAULT
INFO 2020-04-27 15:00:01,305 [main] com.complexible.stardog.cli.impl.ServerStart:call(245): Min Heap Size: 2.0G
INFO 2020-04-27 15:00:01,305 [main] com.complexible.stardog.cli.impl.ServerStart:call(246): Max Heap Size: 1.9G
INFO 2020-04-27 15:00:01,306 [main] com.complexible.stardog.cli.impl.ServerStart:call(247): Max Direct Mem: 1.5G
INFO 2020-04-27 15:00:01,306 [main] com.complexible.stardog.cli.impl.ServerStart:call(248): System Memory: 20G

There are then some logs related to the vg I add. The logs that appear after the failed query are:

WARN 2020-04-27 15:04:06,215 [stardog-user-4] com.complexible.stardog.protocols.http.server.StardogUndertowErrorHandler:accept(61): Unexpected exception was handled by the server
com.complexible.stardog.virtual.vega.UnsupportedTranslation: Unable to translate expression
at com.complexible.stardog.virtual.vega.ExprToRexNode.defaultVisit(ExprToRexNode.java:314) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.filter.BaseExpressionVisitor.visitWithArgs(BaseExpressionVisitor.java:45) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.filter.BaseExpressionVisitor.visit(BaseExpressionVisitor.java:201) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.ExprToRexNode.visit(ExprToRexNode.java:208) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.filter.functions.rdfterm.StrDt.accept(StrDt.java:59) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.ExprToRexNode.visit(ExprToRexNode.java:88) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.filter.expr.Compare.accept(Compare.java:108) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.ExprToRexNode.translateWithTermType(ExprToRexNode.java:329) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.ExprToRexNode.translate(ExprToRexNode.java:319) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.LeftJoinTranslator.join(LeftJoinTranslator.java:98) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.LeftJoinTranslator.translate(LeftJoinTranslator.java:167) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.SqlVirtualTranslator.translate(SqlVirtualTranslator.java:308) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator$BinaryPlanNodeDispatcher.visitJoin(LocalFallbackTranslator.java:207) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:93) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.NestedLoopJoinPlanNode.accept(NestedLoopJoinPlanNode.java:57) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator$BinaryPlanNodeDispatcher.translate(LocalFallbackTranslator.java:217) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.binaryVisit(LocalFallbackTranslator.java:256) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.BasePlanNodeVisitor.visitJoin(BasePlanNodeVisitor.java:88) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:93) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.NestedLoopJoinPlanNode.accept(NestedLoopJoinPlanNode.java:57) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.lambda$visit$0(LocalFallbackTranslator.java:304) ~[stardog-virtual-core-7.2.1.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_252]
at com.google.common.collect.CollectSpliterators$1Splitr.tryAdvance(CollectSpliterators.java:155) ~[guava-27.0-jre.jar:?]
at java.util.Spliterator.forEachRemaining(Spliterator.java:326) ~[?:1.8.0_252]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_252]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_252]
at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:313) ~[?:1.8.0_252]
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743) ~[?:1.8.0_252]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_252]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_252]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_252]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_252]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) ~[?:1.8.0_252]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.streamUnion(LocalFallbackTranslator.java:321) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.visit(LocalFallbackTranslator.java:301) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:112) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.unaryVisit(LocalFallbackTranslator.java:268) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:134) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.FilterPlanNodeImpl.accept(FilterPlanNodeImpl.java:75) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.unaryVisit(LocalFallbackTranslator.java:268) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:134) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.FilterPlanNodeImpl.accept(FilterPlanNodeImpl.java:75) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.unaryVisit(LocalFallbackTranslator.java:268) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:225) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.ProjectionPlanNodeImpl.accept(ProjectionPlanNodeImpl.java:207) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.unaryVisit(LocalFallbackTranslator.java:268) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:217) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.SlicePlanNodeImpl.accept(SlicePlanNodeImpl.java:103) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraph.translate(RdbmsVirtualGraph.java:117) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.virtual.VirtualGraphService.translate(VirtualGraphService.java:128) ~[stardog-virtual-core-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.service.LogicalServiceQuery.toPhysicalQuery(LogicalServiceQuery.java:67) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.service.ServiceTranslator$ServiceTranslatorVisitor.transform(ServiceTranslator.java:99) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:1001) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.ServicePlanNodeImpl.accept(ServicePlanNodeImpl.java:91) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryVisit(TransformingPlanNodeVisitor.java:667) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryTransform(TransformingPlanNodeVisitor.java:98) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:405) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:913) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.ProjectionPlanNodeImpl.accept(ProjectionPlanNodeImpl.java:207) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:83) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.service.ServiceTranslator.optimize(ServiceTranslator.java:41) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.optimizer.OptimizationPipeline.execute(OptimizationPipeline.java:119) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.ExecutablePlanFactory.optimizePlan(ExecutablePlanFactory.java:152) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.ExecutablePlanFactory.lambda$null$0(ExecutablePlanFactory.java:117) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.cache.SimplePlanCache.get(SimplePlanCache.java:102) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.ExecutablePlanFactory.lambda$createOptimized$1(ExecutablePlanFactory.java:117) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.index.IndexUtils.doInTx(IndexUtils.java:156) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.ExecutablePlanFactory.createOptimized(ExecutablePlanFactory.java:110) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:516) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:452) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:302) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:198) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:184) ~[stardog-7.2.1.jar:?]
at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:547) ~[stardog-protocols-http-server-7.2.1.jar:?]
at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:523) ~[stardog-protocols-http-server-7.2.1.jar:?]
at com.complexible.stardog.protocols.http.server.SPARQLProtocol.executeQuery(SPARQLProtocol.java:135) ~[stardog-protocols-http-server-7.2.1.jar:?]
at com.complexible.stardog.protocols.http.server.SPARQLProtocol.post(SPARQLProtocol.java:95) ~[stardog-protocols-http-server-7.2.1.jar:?]
at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-7.2.1.jar:?]
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.3.0.jar:1.3.0] at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.3.0.jar:1.3.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]

Are there any updates?

Thanks for sharing the log details. In the future, please use three backticks to format pastes. It's much easier to read.

The exception stems from the presence of function StrDt in the optional's filter. We have created ticket #8987 for this issue. Additionally, FILTER EXISTS is currently not supported in virtual graph queries.

I also played with a version that did not use StrDt in the optionals and got the same error from what I remember.

I cannot speculate as to the cause of the error on a different query. If you can provide the stack trace the log as you did here, I can look into it.

Using the same FILTER EXISTS expression above and an optional argument of the form:

  OPTIONAL { ?s pref:startTime ?startTimes .
             FILTER(xsd:dateTime(?startTimes)  >= "2017-07-25T00:00:00"^^xsd:dateTime) .
             FILTER(xsd:dateTime(?startTimes)  <= "2017-09-05T23:59:59"^^xsd:dateTime) }

I got the following from the logs

WARN  2020-04-27 21:44:30,639 [stardog-user-4] com.complexible.stardog.protocols.http.server.StardogUndertowErrorHandler:accept(61): Unexpected exception was handled by the server
com.complexible.stardog.virtual.vega.UnsupportedTranslation: Unable to translate expression
        at com.complexible.stardog.virtual.vega.ExprToRexNode.defaultVisit(ExprToRexNode.java:314) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.filter.BaseExpressionVisitor.visitWithArgs(BaseExpressionVisitor.java:45) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.filter.BaseExpressionVisitor.visit(BaseExpressionVisitor.java:169) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.filter.functions.cast.DateTimeCast.accept(DateTimeCast.java:105) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.ExprToRexNode.visit(ExprToRexNode.java:88) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.filter.expr.Compare.accept(Compare.java:108) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.ExprToRexNode.visit(ExprToRexNode.java:104) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.filter.expr.And.accept(And.java:52) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.ExprToRexNode.translateWithTermType(ExprToRexNode.java:329) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.ExprToRexNode.translate(ExprToRexNode.java:319) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.LeftJoinTranslator.join(LeftJoinTranslator.java:98) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.LeftJoinTranslator.translate(LeftJoinTranslator.java:167) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.SqlVirtualTranslator.translate(SqlVirtualTranslator.java:308) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.LocalFallbackTranslator$BinaryPlanNodeDispatcher.visitJoin(LocalFallbackTranslator.java:207) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:93) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.NestedLoopJoinPlanNode.accept(NestedLoopJoinPlanNode.java:57) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.LocalFallbackTranslator$BinaryPlanNodeDispatcher.translate(LocalFallbackTranslator.java:217) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.binaryVisit(LocalFallbackTranslator.java:256) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.BasePlanNodeVisitor.visitJoin(BasePlanNodeVisitor.java:88) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:93) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.NestedLoopJoinPlanNode.accept(NestedLoopJoinPlanNode.java:57) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.unaryVisit(LocalFallbackTranslator.java:268) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:134) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.FilterPlanNodeImpl.accept(FilterPlanNodeImpl.java:75) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.unaryVisit(LocalFallbackTranslator.java:268) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:225) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.ProjectionPlanNodeImpl.accept(ProjectionPlanNodeImpl.java:207) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.LocalFallbackTranslator.unaryVisit(LocalFallbackTranslator.java:268) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.BasePlanNodeVisitor.visit(BasePlanNodeVisitor.java:217) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.SlicePlanNodeImpl.accept(SlicePlanNodeImpl.java:103) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraph.translate(RdbmsVirtualGraph.java:117) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.virtual.VirtualGraphService.translate(VirtualGraphService.java:128) ~[stardog-virtual-core-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.service.LogicalServiceQuery.toPhysicalQuery(LogicalServiceQuery.java:67) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.service.ServiceTranslator$ServiceTranslatorVisitor.transform(ServiceTranslator.java:99) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:1001) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.ServicePlanNodeImpl.accept(ServicePlanNodeImpl.java:91) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryVisit(TransformingPlanNodeVisitor.java:667) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.TransformingPlanNodeVisitor.unaryTransform(TransformingPlanNodeVisitor.java:98) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:405) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.TransformingPlanNodeVisitor.visit(TransformingPlanNodeVisitor.java:913) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.ProjectionPlanNodeImpl.accept(ProjectionPlanNodeImpl.java:207) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.TransformingPlanNodeVisitor.transform(TransformingPlanNodeVisitor.java:83) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.service.ServiceTranslator.optimize(ServiceTranslator.java:41) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.optimizer.OptimizationPipeline.execute(OptimizationPipeline.java:119) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.ExecutablePlanFactory.optimizePlan(ExecutablePlanFactory.java:152) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.ExecutablePlanFactory.lambda$null$0(ExecutablePlanFactory.java:117) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.cache.SimplePlanCache.get(SimplePlanCache.java:102) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.ExecutablePlanFactory.lambda$createOptimized$1(ExecutablePlanFactory.java:117) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.index.IndexUtils.doInTx(IndexUtils.java:156) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.ExecutablePlanFactory.createOptimized(ExecutablePlanFactory.java:110) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:516) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:452) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:302) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:198) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:184) ~[stardog-7.2.1.jar:?]
        at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:547) ~[stardog-protocols-http-server-7.2.1.jar:?]
        at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:523) ~[stardog-protocols-http-server-7.2.1.jar:?]
        at com.complexible.stardog.protocols.http.server.SPARQLProtocol.executeQuery(SPARQLProtocol.java:135) ~[stardog-protocols-http-server-7.2.1.jar:?]
        at com.complexible.stardog.protocols.http.server.SPARQLProtocol.post(SPARQLProtocol.java:95) ~[stardog-protocols-http-server-7.2.1.jar:?]
        at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-7.2.1.jar:?]
        at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.3.0.jar:1.3.0]
        at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.3.0.jar:1.3.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]

I did not get an error message when running queries with just FILTER EXISTS clause. If this is not supported for virtual graphs, and especially if I am going to get the wrong data or no data, shouldn't there be an error message informing me of this?

I think you should be able to use a subquery in place of the FILTER EXISTS. I think these to queries return the same results:

SELECT * WHERE {
    ?s a :Object.
    FILTER EXISTS {
        { ?s :startTime ?startTimes }
        UNION
        { ?s :endTime ?endTimes }
        UNION
        { ?s :time ?times }
    }
    OPTIONAL {
        ?s :startTime ?startTimes .
        FILTER(StrDt(?startTimes, xsd:dateTime) >= "2017-07-25T00:00:00"^^xsd:dateTime).
        FILTER(StrDt(?startTimes, xsd:dateTime) <= "2017-09-05T23:59:59"^^xsd:dateTime).
    }
}

and

SELECT * WHERE {
    ?s a :Object.
    {
        SELECT DISTINCT ?s {
            { ?s :startTime ?startTimes }
            UNION
            { ?s :endTime ?endTimes }
            UNION
            { ?s :time ?times }
        }
    }
    OPTIONAL {
        ?s :startTime ?startTimes .
        FILTER(StrDt(?startTimes, xsd:dateTime) >= "2017-07-25T00:00:00"^^xsd:dateTime).
        FILTER(StrDt(?startTimes, xsd:dateTime) <= "2017-09-05T23:59:59"^^xsd:dateTime).
    }
}

-Paul