String query = "SELECT testName, inputURL, outputURL " + "FROM {} mf:name {testName}; "
+ " mf:result {outputURL}; " + " mf:action {} qt:data {inputURL} "
+ "USING NAMESPACE " + " mf = <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>, "
+ " qt = <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>";
TupleQueryResult queryResult = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();
// Add all positive parser tests to the test suite
while (queryResult.hasNext()) {
BindingSet bindingSet = queryResult.next();
testName = ((Literal)bindingSet.getValue("testName")).getLabel();
inputURL = ((URI)bindingSet.getValue("inputURL")).toString();
outputURL = ((URI)bindingSet.getValue("outputURL")).toString();
baseURL = BASE_URL + testName + ".ttl";
suite.addTest(new PositiveParserTest(testName, inputURL, outputURL, baseURL));
}
queryResult.close();
// Add the manifest for negative test cases to a repository and query it
con.clear();
url = TurtleParserTest.class.getResource(MANIFEST_BAD_URL);
con.add(url, url.toExternalForm(), RDFFormat.TURTLE);
query = "SELECT testName, inputURL " + "FROM {} mf:name {testName}; "
+ " mf:action {} qt:data {inputURL} " + "USING NAMESPACE "
+ " mf = <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>, "
+ " qt = <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>";
queryResult = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();
// Add all negative parser tests to the test suite
while (queryResult.hasNext()) {
BindingSet bindingSet = queryResult.next();
testName = ((Literal)bindingSet.getValue("testName")).toString();
inputURL = ((URI)bindingSet.getValue("inputURL")).toString();
baseURL = BASE_URL + testName + ".ttl";
suite.addTest(new NegativeParserTest(testName, inputURL, baseURL));
}
queryResult.close();
con.close();
repository.shutDown();
return suite;
}