stardog-union / pellet

Pellet is an OWL 2 reasoner in Java; open source (AGPL) and commercially licensed, commercial support available.
http://clarkparsia.com/pellet
Other
306 stars 151 forks source link

ConcurrentModificationException in com.clarkparsia.pellet.rules.ContinuousRulesStrategy #26

Open tobias-hammerschmidt opened 9 years ago

tobias-hammerschmidt commented 9 years ago

Just found an issue within the pellet rule processing. If I have a swrl rule like this:

User(?user), hasRole(?user, ?role), DifferentFrom(?role, ROLE_ADMIN) -> deniedPermission(?user, "CREATE"^^string), deniedPermission(?user, "UPDATE"^^string)

a ConcurrentModificationException is triggered in com.clarkparsia.pellet.rules.ContinuousRulesStrategy because during iteration over the partial bindings new bindings are added:

com.clarkparsia.pellet.rules.ContinuousRulesStrategy.addPartialBinding(ContinuousRulesStrategy.java:73)
    com.clarkparsia.pellet.rules.rete.ProductionNode$ProduceBinding.activate(ProductionNode.java:223)
    com.clarkparsia.pellet.rules.rete.BetaNode.activateChildren(BetaNode.java:24)
    com.clarkparsia.pellet.rules.rete.BetaMemoryNode.activate(BetaMemoryNode.java:75)
    com.clarkparsia.pellet.rules.rete.BetaNode.activateChildren(BetaNode.java:24)
    com.clarkparsia.pellet.rules.rete.BetaMemoryNode.activate(BetaMemoryNode.java:58)
    com.clarkparsia.pellet.rules.rete.AlphaNode.activate(AlphaNode.java:55)
    com.clarkparsia.pellet.rules.rete.AlphaTypeNode.activate(AlphaTypeNode.java:61)
    com.clarkparsia.pellet.rules.rete.AlphaNetwork.activateType(AlphaNetwork.java:161)
    com.clarkparsia.pellet.rules.ContinuousRulesStrategy.addType(ContinuousRulesStrategy.java:95)
    org.mindswap.pellet.tableau.completion.CompletionStrategy.applyDomainRange(CompletionStrategy.java:624)
    org.mindswap.pellet.tableau.completion.CompletionStrategy.applyPropertyRestrictions(CompletionStrategy.java:594)
    org.mindswap.pellet.tableau.completion.CompletionStrategy.addEdge(CompletionStrategy.java:583)
    com.clarkparsia.pellet.rules.ContinuousRulesStrategy.addEdge(ContinuousRulesStrategy.java:78)
    com.clarkparsia.pellet.rules.RuleAtomAsserter.addEdge(RuleAtomAsserter.java:123)
    com.clarkparsia.pellet.rules.RuleAtomAsserter.visit(RuleAtomAsserter.java:136)
    com.clarkparsia.pellet.rules.model.DatavaluedPropertyAtom.accept(DatavaluedPropertyAtom.java:36)
    com.clarkparsia.pellet.rules.RuleAtomAsserter.assertAtom(RuleAtomAsserter.java:73)
    com.clarkparsia.pellet.rules.ContinuousRulesStrategy.createDisjunctionsFromBinding(ContinuousRulesStrategy.java:323)
    com.clarkparsia.pellet.rules.ContinuousRulesStrategy.applyRuleBindings(ContinuousRulesStrategy.java:164)
    com.clarkparsia.pellet.rules.ContinuousRulesStrategy.complete(ContinuousRulesStrategy.java:254)
    org.mindswap.pellet.ABox.isConsistent(ABox.java:1423)
    org.mindswap.pellet.ABox.isConsistent(ABox.java:1260)
    org.mindswap.pellet.KnowledgeBase.consistency(KnowledgeBase.java:2015)
    org.mindswap.pellet.KnowledgeBase.isConsistent(KnowledgeBase.java:2089)
    org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:259)
    org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:242)
    org.mindswap.pellet.jena.PelletInfGraph.findWithContinuation(PelletInfGraph.java:162)
    com.hp.hpl.jena.reasoner.BaseInfGraph.graphBaseFind(BaseInfGraph.java:383)
    com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:307)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern$TripleMapper.<init>(QueryIterTriplePattern.java:80)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern.nextStage(QueryIterTriplePattern.java:53)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:110)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:67)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:103)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:67)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterBlockTriples.hasNextBinding(QueryIterBlockTriples.java:64)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIterDistinctReduced.hasNextBinding(QueryIterDistinctReduced.java:54)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
    com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:75)
    com.hp.hpl.jena.sparql.engine.ResultSetCheckCondition.hasNext(ResultSetCheckCondition.java:59)
tobias-hammerschmidt commented 9 years ago

A fix is available in https://github.com/Complexible/pellet/pull/27.