Invalid property path in rule causes NPE


(zachary.whitley) #1

It’s Stardog Saturday and I think I’ve come across a bug. It’s sort of my fault. I wasn’t thinking and added a * property path to a rule and rather than give an error it threw a NPE.

Stardog 5.3.2

prefix rule: <tag:stardog:api:rule:>

insert data {

[] a rule:SPARQLRule;
rule:content """
IF {
  ?a :b+ :c .
} THEN {
?a :c :d }
""".
}

select * where {:a ?p ?o}

Like I said, stupid on my part but I figured you didn’t want it throwing the exception either.

java.lang.NullPointerException: null
        at java.util.ArrayList.addAll(ArrayList.java:577) ~[?:1.8.0_131]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser$RuleVisitor$1.visit(SPARQLRuleSyntaxParser.java:236) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.plan.ScopeNodeImpl.accept(ScopeNodeImpl.java:120) ~[stardog-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser$RuleVisitor.visit(SPARQLRuleSyntaxParser.java:229) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser$RuleVisitor.visit(SPARQLRuleSyntaxParser.java:315) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser$RuleVisitor.visit(SPARQLRuleSyntaxParser.java:209) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.common.rdf.query.parser.sparql.ast.ASTIfThenQuery.jjtAccept(ASTIfThenQuery.java:27) ~[stardog-utils-rdf-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser$RuleVisitor.visit(SPARQLRuleSyntaxParser.java:354) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser$RuleVisitor.visit(SPARQLRuleSyntaxParser.java:209) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.common.rdf.query.parser.sparql.ast.ASTIfThenQueryContainer.jjtAccept(ASTIfThenQueryContainer.java:17) ~[stardog-utils-rdf-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser$RuleParser.parseRule(SPARQLRuleSyntaxParser.java:172) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.SPARQLRuleSyntaxParser.parseRule(SPARQLRuleSyntaxParser.java:132) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.RuleExtractor.parseRule(RuleExtractor.java:146) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.rule.RuleExtractor.extractSPARQLRules(RuleExtractor.java:72) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.blackout.BlackoutReasonerUtils.extractRules(BlackoutReasonerUtils.java:159) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.blackout.BlackoutReasonerUtils.extractTBox(BlackoutReasonerUtils.java:284) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.blackout.BlackoutReasoner.computeState(BlackoutReasoner.java:334) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.blackout.BlackoutReasoner.getState(BlackoutReasoner.java:286) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.blackout.BlackoutReasoner.openConnection(BlackoutReasoner.java:186) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.ConnectableReasoner.openConnection(ConnectableReasoner.java:118) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.reasoning.ConnectableReasoner.openConnection(ConnectableReasoner.java:33) ~[stardog-reasoning-core-5.3.2.jar:?]
        at com.complexible.stardog.db.DatabaseImpl.connect(DatabaseImpl.java:1218) ~[stardog-5.3.2.jar:?]
        at com.complexible.stardog.db.DatabaseImpl.openConnection(DatabaseImpl.java:1130) ~[stardog-5.3.2.jar:?]
        at com.complexible.stardog.StardogKernel.getConnection(StardogKernel.java:1196) ~[stardog-5.3.2.jar:?]
        at com.complexible.stardog.protocols.http.server.KernelHttpService.openConnection(KernelHttpService.java:101) ~[stardog-protocols-http-server-5.3.2.jar:?]
        at com.complexible.stardog.protocols.http.server.KernelHttpService.openConnection(KernelHttpService.java:93) ~[stardog-protocols-http-server-5.3.2.jar:?]
        at com.complexible.stardog.protocols.http.server.SPARQLProtocol.executeQuery(SPARQLProtocol.java:129) ~[stardog-protocols-http-server-5.3.2.jar:?]
        at com.complexible.stardog.protocols.http.server.SPARQLProtocol.post(SPARQLProtocol.java:111) ~[stardog-protocols-http-server-5.3.2.jar:?]
        at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-5.3.2.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_131]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_131]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]