Hi,

I believe there is a regression bug somewhere between 2.7.2 and 2.10.2. See test case which works green in the old version but fails on the latest snapshot. I believe the cause is that TransformFilterImplicitJoin.testSpecialCaseUnused() incorrectly assumes it can ignore the whole query if it encounters unbound variables. However, in my case the variables do have values, coming from the initial binding of the QueryExecution.

Thanks,
Holger

package org.topbraid.core.rdf;

import org.junit.Assert;
import org.junit.Test;

import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolutionMap;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.vocabulary.OWL;
import com.hp.hpl.jena.vocabulary.RDF;

public class TestPreboundFilter {

        @Test
        public void testFilter() {
                Query query = QueryFactory.create(
                                "ASK\n" +
                                "WHERE {\n" +
                                "    FILTER (?a = ?b) .\n" +
                                "}");
                Model model = ModelFactory.createDefaultModel();
                model.add(OWL.Thing, RDF.type, OWL.Class);
                QuerySolutionMap initialBinding = new QuerySolutionMap();
                initialBinding.add("a", 
ResourceFactory.createTypedLiteral(Boolean.TRUE));
                initialBinding.add("b", 
ResourceFactory.createTypedLiteral(Boolean.TRUE));
                QueryExecution qexec = QueryExecutionFactory.create(query, 
model, initialBinding);
                boolean result = qexec.execAsk();
                Assert.assertTrue(result);
        }
}

Reply via email to