Search in sources :

Example 1 with Bigdata2ASTSPARQLParser

use of com.bigdata.rdf.sail.sparql.Bigdata2ASTSPARQLParser in project wikidata-query-rdf by wikimedia.

the class LabelServiceUnitTest method assertLabelQueryResult.

// Blazegraph throws RuntimeException wrapping various checked exceptions and it make it very useful
// to print the query plan for debugging if any test fails
@SuppressWarnings({ "checkstyle:illegalcatch" })
@SafeVarargs
private final void assertLabelQueryResult(String query, final Matcher<BindingSet>... bindingMatchers) {
    ASTContainer astContainer = null;
    try {
        TupleQueryResult q;
        try {
            astContainer = new Bigdata2ASTSPARQLParser().parseQuery2(query, null);
            q = ASTEvalHelper.evaluateTupleQuery(store(), astContainer, new QueryBindingSet(), null);
        } catch (MalformedQueryException | QueryEvaluationException e) {
            throw new RuntimeException(e);
        }
        assertResult(q, bindingMatchers);
    } catch (AssertionError | RuntimeException e) {
        log.error("Error while checking results for {}", astContainer);
        throw e;
    }
}
Also used : ASTContainer(com.bigdata.rdf.sparql.ast.ASTContainer) Bigdata2ASTSPARQLParser(com.bigdata.rdf.sail.sparql.Bigdata2ASTSPARQLParser) QueryEvaluationException(org.openrdf.query.QueryEvaluationException) MalformedQueryException(org.openrdf.query.MalformedQueryException) TupleQueryResult(org.openrdf.query.TupleQueryResult) QueryBindingSet(org.openrdf.query.algebra.evaluation.QueryBindingSet)

Example 2 with Bigdata2ASTSPARQLParser

use of com.bigdata.rdf.sail.sparql.Bigdata2ASTSPARQLParser in project wikidata-query-rdf by wikimedia.

the class MWApiServiceQueryUnitTest method assertQueryResult.

// Blazegraph throws RuntimeException wrapping various checked exceptions and it make it very useful
// to print the query plan for debugging if any test fails
@SuppressWarnings({ "checkstyle:illegalcatch" })
@SafeVarargs
private final void assertQueryResult(String query, final Matcher<BindingSet>... bindingMatchers) {
    ASTContainer astContainer = null;
    try {
        TupleQueryResult q;
        try {
            astContainer = new Bigdata2ASTSPARQLParser().parseQuery2(query, null);
            q = ASTEvalHelper.evaluateTupleQuery(store(), astContainer, new QueryBindingSet(), null);
        } catch (MalformedQueryException | QueryEvaluationException e) {
            throw new RuntimeException(e);
        }
        assertResult(q, bindingMatchers);
    } catch (AssertionError | RuntimeException e) {
        log.error("Error while checking results for {} ", astContainer);
        throw e;
    }
}
Also used : ASTContainer(com.bigdata.rdf.sparql.ast.ASTContainer) Bigdata2ASTSPARQLParser(com.bigdata.rdf.sail.sparql.Bigdata2ASTSPARQLParser) QueryEvaluationException(org.openrdf.query.QueryEvaluationException) MalformedQueryException(org.openrdf.query.MalformedQueryException) TupleQueryResult(org.openrdf.query.TupleQueryResult) QueryBindingSet(org.openrdf.query.algebra.evaluation.QueryBindingSet)

Aggregations

Bigdata2ASTSPARQLParser (com.bigdata.rdf.sail.sparql.Bigdata2ASTSPARQLParser)2 ASTContainer (com.bigdata.rdf.sparql.ast.ASTContainer)2 MalformedQueryException (org.openrdf.query.MalformedQueryException)2 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)2 TupleQueryResult (org.openrdf.query.TupleQueryResult)2 QueryBindingSet (org.openrdf.query.algebra.evaluation.QueryBindingSet)2