Hi,
We want to perform some operations when new data is inserted into Stardog DB (version 7.9.0) . We are trying Stardog Stardog transaction framework to achieve this. We are following the exapmle code - stardog-examples/examples/connectable at develop · stardog-union/stardog-examples · GitHub .
- To make it compile successfully, we had to change the following method
@Override
public Set getQueryRewritings() {
// no query rewritings are performed
return ImmutableSet.of();
}
to
@Override
public Set getQueryRewritings() {
// no query rewritings are performed
return ImmutableSet.of();
}
(Just changed the methid signature) So is this code upto date and can be used with latest Stardog server version 7.9.0 ?
- After successful compilation with above change, when deployed in stardog server, but our queries started failing with NullPointerException. If we remove this transaction listener, queries are executed successfully.
Transaction started for database mg-test
ERROR 2022-04-13 08:33:19,270 [stardog-user-2] com.complexible.stardog.QueryManager:exceptionTriggered(542): Error during execution of the query
SELECT ?cust ?custId ?contact WHERE { GRAPH <tenant1:xxx-profiles> {?cust a xxx:Customer ;
xxx:id ?custId ; xxx:has_contact ?contact .
?contact ?p ?o .
}
VALUES ?o { "47337aac-ab1b-4fe7-8f13-a1445468f97b" }
}
with query plan
prefix : <http://api.stardog.com/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix stardog: <tag:stardog:api:>
Projection(?cust, ?custId, ?contact)
`─ {
`─ {
`─ Scan[SPO](?cust, <http://ontologies.xyz.com/xxx/has_contact>, ?contact){<tenant1:xxx-profiles>}
`─ Scan[SPO](?cust, <http://ontologies.xyz.com/xxx/id>, ?custId){<tenant1:xxx-profiles>}
`─ Scan[SPO](?cust, rdf:type, <http://ontologies.xyz.com/xxx/Customer>){<tenant1:xxx-profiles>}
`─ Scan[SPO](?contact, ?p, ?o){<tenant1:xxx-profiles>}
}
VALUES (?o) {
`─ ( "47337aac-ab1b-4fe7-8f13-a1445468f97b" )
}
}
against database mg-test
java.lang.NullPointerException: null
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1632) ~[?:?]
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127) ~[?:?]
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543) ~[?:?]
at com.complexible.stardog.db.ConnectableConnectionCollection.as(ConnectableConnectionCollection.java:110) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.db.DatabaseConnectionImpl.as(DatabaseConnectionImpl.java:764) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.db.DelegatingConnectableConnection.as(DelegatingConnectableConnection.java:61) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.db.ConnectableConnection.as(ConnectableConnection.java:54) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine$QueryTransactionalConnectableRWConnection.as(QueryEngine.java:805) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.cache.ReplaceCachedGraphs$Visitor.lambda$getReuseDecisionFunction$6(ReplaceCachedGraphs.java:270) ~[stardog-cache-core-7.9.0.jar:?]
at com.complexible.stardog.plan.cache.ReuseDecisionFunctions$CombinedReuseDecisionFunction.lambda$decide$0(ReuseDecisionFunctions.java:175) ~[stardog-7.9.0.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:558) ~[?:?]
at java.util.stream.ReferencePipeline.max(ReferencePipeline.java:594) ~[?:?]
at com.complexible.stardog.plan.cache.ReuseDecisionFunctions$CombinedReuseDecisionFunction.decide(ReuseDecisionFunctions.java:176) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.cache.CachedPlan.isReusableFor(CachedPlan.java:55) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.cache.SimplePlanCache.lookup(SimplePlanCache.java:176) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.cache.SimplePlanCache.get(SimplePlanCache.java:100) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.ExecutablePlanFactory.lambda$createOptimized$2(ExecutablePlanFactory.java:153) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.index.IndexUtils.doInTx(IndexUtils.java:217) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.ExecutablePlanFactory.createOptimized(ExecutablePlanFactory.java:140) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:693) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executePlan(QueryEngine.java:419) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executePlan(QueryEngine.java:401) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelectPlan(QueryEngine.java:361) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:344) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$SelectQuery.execute(DefaultQueryFactory.java:269) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.query.DefaultQueryFactory$SelectQuery.execute(DefaultQueryFactory.java:255) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.query.DelegatingQuery.execute(DelegatingQuery.java:68) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.db.DatabaseImpl$TimerPausingReadQuery.execute(DatabaseImpl.java:1779) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.db.DatabaseImpl$TimerPausingReadQuery.execute(DatabaseImpl.java:1766) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.query.DelegatingQuery.execute(DelegatingQuery.java:60) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.StardogKernel$SecuredReadQuery.execute(StardogKernel.java:4847) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.StardogKernel$SecuredReadQuery.execute(StardogKernel.java:4834) ~[stardog-7.9.0.jar:?]
at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:542) ~[stardog-protocols-http-server-7.9.0.jar:?]
at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:515) ~[stardog-protocols-http-server-7.9.0.jar:?]
at com.complexible.stardog.protocols.http.server.SPARQLProtocol.executeQuery(SPARQLProtocol.java:250) ~[stardog-protocols-http-server-7.9.0.jar:?]
at com.complexible.stardog.protocols.http.server.SPARQLProtocol.getSparqlQuery(SPARQLProtocol.java:139) ~[stardog-protocols-http-server-7.9.0.jar:?]
at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-7.9.0.jar:?]
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.8.0.jar:1.8.0]
at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.8.0.jar:1.8.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
Any idea why queries are failing and how to fix this issue.?
- Is there any way to restrict invocation of this listener to a list of db?
- Also where to find javadoc for com.complexible.stardog.db.ConnectableConnection and other classes used in this example?
Thanks!