SERVICE query error

Hi, I am trying to troubleshoot the query below that is utilizing the SERVICE query to get results from another Stardog database. The query begins to work and shows some records as part of the result. However, when I try to export the results to any type of file, it runs into an error. Below are sample errors generated when trying to export to an RDF/XML file:

“error on line 859 at column 10: expected '>'”

“error on line 1380 at column 5: Extra content at the end of the document”

The following is an error that was logged in stardog.log:

“WARN  2019-09-03 12:09:03,985 [stardog-user-17] com.complexible.stardog.plan.optimizer.BranchAndBoundOptimizer:lambda$search$3(163): Unknown cost for the node MergeJoin(key=3 card=UNKNOWN[PROBABLY_OFF] cost=NaN) during join order optimization
ERROR 2019-09-03 12:09:04,063 [stardog-user-17] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(229): An unexpected exception was handled by the server
…”

This was the query used:

SELECT ?trial ?start ?intCui ?entityLabel ?moa ?moaLabel WHERE {

?trial act:hasIntervention ?int.
?trial act:hasStartDate ?start. 
?int act:hasIntConcept ?intConcept.
?intConcept act:hasCUI ?intCui.

        SERVICE <db://UMLS>{
          ?entity umls:cui ?intCui .
         ?entity <http://purl.bioontology.org/ontology/NDFRT/has_mechanism_of_action> ?moa. 
          ?moa skos:prefLabel ?moaLabel.
          ?entity skos:prefLabel ?entityLabel

}
}

Though the query works partially using the web interface, it fails when using Stardog Studio. Is there a better way to do this?

Advice is greatly appreciated! Thank you.

Hi Christina!
Can you include the entire log file? Or at least the stack trace after the error?

Thank you for your time, below is the rest of the log file:

"WARN  2019-09-03 12:09:03,985 [stardog-user-17] com.complexible.stardog.plan.optimizer.BranchAndBoundOptimizer:lambda$search$3(163): Unknown cost for the node MergeJoin(key=3 card=UNKNOWN[PROBABLY_OFF] cost=NaN) during join order optimization
ERROR 2019-09-03 12:09:04,063 [stardog-user-17] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(229): An unexpected exception was handled by the server
org.openrdf.query.QueryEvaluationException: Connection user 'null' is not authenticated.
	at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:81) ~[stardog-utils-rdf-5.3.0.jar:?]
	at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.1.2.jar:?]
	at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.writeTupleResponse(ProtocolUtils.java:601) ~[stardog-protocols-http-server-5.3.0.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:508) ~[stardog-protocols-http-server-5.3.0.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.executeQuery(QueryPanelService.java:162) ~[stardog-webconsole-annex-5.3.0.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.post(QueryPanelService.java:112) ~[stardog-webconsole-annex-5.3.0.jar:?]
	at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-5.3.0.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:1142) [?:1.8.0_65]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_65]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]
Caused by: com.complexible.stardog.plan.eval.operator.OperatorException: Connection user 'null' is not authenticated.
	at com.complexible.stardog.KernelDatabaseService$KernelDatabaseServiceQuery.evaluate(KernelDatabaseService.java:131) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.service.BatchingJoinArgServiceQuery$BatchingJoinArgIterator.nextIterator(BatchingJoinArgServiceQuery.java:132) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.service.BatchingJoinArgServiceQuery$BatchingJoinArgIterator.computeNext(BatchingJoinArgServiceQuery.java:141) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.service.BatchingJoinArgServiceQuery$BatchingJoinArgIterator.computeNext(BatchingJoinArgServiceQuery.java:80) ~[stardog-5.3.0.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.impl.ServiceOperatorImpl.computeNext(ServiceOperatorImpl.java:85) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.ServiceOperatorImpl.computeNext(ServiceOperatorImpl.java:30) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:82) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:29) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SliceOp._hasNext(SliceOp.java:87) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:95) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:26) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:112) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:25) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:110) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:34) ~[stardog-5.3.0.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-5.3.0.jar:?]
	... 12 more
Caused by: com.complexible.stardog.security.StardogAuthenticationException: Connection user 'null' is not authenticated.
	at com.complexible.stardog.Kernels.assertAuthenticated(Kernels.java:238) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.StardogKernel.getConnection(StardogKernel.java:1129) ~[stardog-5.3.0.jar:?]
	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_65]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_65]
	at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:50) ~[guice-4.0.jar:?]
	at com.sun.proxy.$Proxy43.getConnection(Unknown Source) ~[?:?]
	at com.complexible.stardog.KernelDatabaseService.connect(KernelDatabaseService.java:157) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.KernelDatabaseService.access$000(KernelDatabaseService.java:50) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.KernelDatabaseService$KernelDatabaseServiceQuery.evaluate(KernelDatabaseService.java:114) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.service.BatchingJoinArgServiceQuery$BatchingJoinArgIterator.nextIterator(BatchingJoinArgServiceQuery.java:132) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.service.BatchingJoinArgServiceQuery$BatchingJoinArgIterator.computeNext(BatchingJoinArgServiceQuery.java:141) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.service.BatchingJoinArgServiceQuery$BatchingJoinArgIterator.computeNext(BatchingJoinArgServiceQuery.java:80) ~[stardog-5.3.0.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.impl.ServiceOperatorImpl.computeNext(ServiceOperatorImpl.java:85) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.ServiceOperatorImpl.computeNext(ServiceOperatorImpl.java:30) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:82) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:29) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SliceOp._hasNext(SliceOp.java:87) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:95) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:26) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:112) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:25) ~[stardog-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:110) ~[stardog-5.3.0.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:34) ~[stardog-5.3.0.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-5.3.0.jar:?]
	... 12 more"

Hi Christina,
This looks like a bug with optimization of the inter-DB query service. You can try executing your query by hinting to disable the optimization. You just need to add this wrapper around the service block:

{ #pragma group.joins
  service <...> { ... }
}

Jess

Hi Jess,
Your suggestion has worked, thank you very much - greatly appreciate it!
Best regards,
Christina

Glad to hear. We'll get this fixed soon.

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