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
305 stars 152 forks source link

IndexOutOfBoundsException in BetaNode.java for rules with multiple atoms like p(?x,?x), p(?y, ?y) #4

Open Christian-D opened 10 years ago

Christian-D commented 10 years ago

When using multiple atoms with only one variable each in context of an DL-safe rule, the call PelletReasoner.getKB.realize() fails with the following exception:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at com.clarkparsia.pellet.rules.rete.BetaNode.join(BetaNode.java:123) at com.clarkparsia.pellet.rules.rete.Interpreter.processBetaNodes(Interpreter.java:109) at com.clarkparsia.pellet.rules.rete.Interpreter.run(Interpreter.java:236) at com.clarkparsia.pellet.rules.ContinuousRulesStrategy.applyRete(ContinuousRulesStrategy.java:179) at com.clarkparsia.pellet.rules.ContinuousRulesStrategy.complete(ContinuousRulesStrategy.java:322) at org.mindswap.pellet.ABox.isConsistent(ABox.java:1423) at org.mindswap.pellet.ABox.isConsistent(ABox.java:1260) at org.mindswap.pellet.KnowledgeBase.consistency(KnowledgeBase.java:1987) at org.mindswap.pellet.KnowledgeBase.isConsistent(KnowledgeBase.java:2061) at org.mindswap.pellet.KnowledgeBase.ensureConsistency(KnowledgeBase.java:2075) at org.mindswap.pellet.KnowledgeBase.classify(KnowledgeBase.java:2083) at org.mindswap.pellet.KnowledgeBase.realize(KnowledgeBase.java:2111)

The "rolification" of a class is used to increase the performance of the reasoning process. The following model (functional syntax) may be used to reproduce the error:

Prefix(owl:=http://www.w3.org/2002/07/owl#) Prefix(rdf:=http://www.w3.org/1999/02/22-rdf-syntax-ns#) Prefix(xml:=http://www.w3.org/XML/1998/namespace) Prefix(xsd:=http://www.w3.org/2001/XMLSchema#) Prefix(rdfs:=http://www.w3.org/2000/01/rdf-schema#)

Ontology(http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215 Import(http://www.w3.org/2006/time)

EquivalentClasses(http://www.w3.org/2006/time#Instant ObjectHasSelf(http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#R_Instant)) Declaration(ObjectProperty(http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#R_Instant)) Declaration(NamedIndividual(http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#Instant1)) ClassAssertion(http://www.w3.org/2006/time#Instant http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#Instant1) DataPropertyAssertion(http://www.w3.org/2006/time#inXSDDateTime http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#Instant1 "2000-01-01T00:00:00"^^xsd:dateTime) Declaration(NamedIndividual(http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#Instant2)) ClassAssertion(http://www.w3.org/2006/time#Instant http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#Instant2) DataPropertyAssertion(http://www.w3.org/2006/time#inXSDDateTime http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#Instant2 "2003-01-01T00:00:00"^^xsd:dateTime) DLSafeRule(Body(ObjectPropertyAtom(http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#R_Instant Variable(urn:swrl#x) Variable(urn:swrl#x)) ObjectPropertyAtom(http://www.semanticweb.org/ontologies/2014/3/untitled-ontology-215#R_Instant Variable(urn:swrl#z) Variable(urn:swrl#z)) DataPropertyAtom(http://www.w3.org/2006/time#inXSDDateTime Variable(urn:swrl#x) Variable(urn:swrl#y)) DataPropertyAtom(http://www.w3.org/2006/time#inXSDDateTime Variable(urn:swrl#z) Variable(urn:swrl#w)) BuiltInAtom(http://www.w3.org/2003/11/swrlb#lessThan Variable(urn:swrl#y) Variable(urn:swrl#w)))Head(ObjectPropertyAtom(http://www.w3.org/2006/time#before Variable(urn:swrl#x) Variable(urn:swrl#z)))) )

Christian-D commented 10 years ago

I found this related ticket: https://clark-parsia.trac.cvsdude.com/pellet-devel/ticket/382 . The fix (I suppose it is the if-condition at lines 118-119 of the BetaNode class ?) works for one expression like p(?x, ?x), but two or more will fail. Maybe these lines may need to be revised when considering a fix.