[Pellet-users] query bug?
Evren Sirin
evren at clarkparsia.com
Fri May 30 19:38:33 UTC 2008
Hi Antonio,
This looks like a bug because that part of the code was written with the
assumption that the query would have a single connected component so
rolling up the whole query to one constant would be enough. I've
recorded the issue in the tracker [1] and we'll look into what solution
is best (either what you suggest or fix the calling method to handle
multiple connected components).
Cheers,
Evren
[1] http://cvsdude.com/trac/clark-parsia/pellet-devel/ticket/126
On 5/29/08 8:47 AM, Antonio Sanchez Ruiz-Granados wrote:
> Hi,
>
> I am working with Pellet 1.5.2 and I am using intensely the incremental
> reasoning feature of this reasoner. I also use SPARQL queries to
> retrieve ABox instances. After making some ABox changes, one of the
> SPARQL queries wasn't working as I expected. The query has the form
>
> ASK { dom:i1 rdf:type dom:C1. dom:i1 rdf:type dom:C2. prob:i2 rdf:type
> dom:C3. }
>
> where {dom:i1, dom:i2} are two instances of my ontology and {dom:C1,
> dom:C2, dom:C3} are concepts.
>
> I started to debug the Pellet java code and I traced it to the method
> execBoolean of the class
> org.mindswap.pellet.query.impl.NoDistVarsQueryExec. I paste the code
> below. Reading this code if any of the query triples is UNKNOWN and the
> query cannot be directly asserted as false, it reaches the point below
> the comment "// do the unavoidable consistency check" where only the
> type of the first constant is checked. My problem was that my query
> should be false because the second instance, but the method only checks
> the first one (so it returns true even when it shouldn't). I have
> changed that part so now it checks all the constants in the query and it
> seems to work right, but I don't know if this is really a bug or I am
> misunderstanding something.
>
> Thanks in advance,
> Antonio Sánchez.
>
>
> public boolean execBoolean( Query query ) {
> boolean querySatisfied;
>
> kb = query.getKB();
>
> if( query.getConstants().isEmpty() ) {
> throw new UnsupportedFeatureException(
> "Executing queries with no constants is not implemented
> yet!" );
> }
>
> // unless proven otherwise all (ground) triples are satisfied
> Bool allTriplesSatisfied = Bool.TRUE;
>
> List patterns = query.getQueryPatterns();
> for(int i = 0; i < patterns.size(); i++) {
> QueryPattern triple = (QueryPattern) patterns.get(i);
>
> // by default we don't know if triple is satisfied
> Bool tripleSatisfied = Bool.UNKNOWN;
> // we can only check ground triples
> if( triple.isGround() ) {
> tripleSatisfied = triple.isTypePattern()
> ? kb.isKnownType( triple.getSubject(),
> triple.getObject() )
> : kb.hasKnownPropertyValue( triple.getSubject(),
> triple.getPredicate(), triple.getObject());
> }
>
> // if we cannot decide the truth value of this triple
> (without a consistency
> // check) then over all truth value cannot be true. However,
> we will continue
> // to see if there is a triple that is obviously false
> if( tripleSatisfied.isUnknown() )
> allTriplesSatisfied = Bool.UNKNOWN;
> else if( tripleSatisfied.isFalse() ) {
> // if one triple is false then the whole query, which is
> the conjunction of
> // all triples, is false. We can stop now.
> allTriplesSatisfied = Bool.FALSE;
>
> if( log.isTraceEnabled() )
> log.trace( "Failed triple: " + triple );
>
> break;
> }
> }
>
> // if we reached a verdict, return it
> if( allTriplesSatisfied.isKnown() )
> querySatisfied = allTriplesSatisfied.isTrue();
> else {
> // do the unavoidable consistency check
> ATermAppl testInd = (ATermAppl)
> query.getConstants().iterator().next();
> ATermAppl testClass = query.rollUpTo( testInd );
>
> if( log.isTraceEnabled() )
> log.trace( "Boolean query: " + testInd + " -> " +
> testClass );
>
> querySatisfied = kb.isType( testInd, testClass );
> }
>
> return querySatisfied;
> }
>
>
More information about the Pellet-users
mailing list