con.add(manifest, MANIFEST_FILE, rdfFormat);
logger.info("Searching for sub-manifests");
List<String> subManifestList = new ArrayList<String>();
TupleQueryResult subManifests = con.prepareTupleQuery(QueryLanguage.SERQL, SUBMANIFEST_QUERY).evaluate();
while (subManifests.hasNext()) {
BindingSet bindings = subManifests.next();
subManifestList.add(bindings.getValue("subManifest").toString());
}
subManifests.close();
logger.info("Found {} sub-manifests", subManifestList.size());
for (String subManifest : subManifestList) {
logger.info("Loading sub manifest {}", subManifest);
con.clear();
URL subManifestURL = new URL(subManifest);
rdfFormat = RDFFormat.forFileName(subManifest, RDFFormat.TURTLE);
con.add(subManifestURL, subManifest, rdfFormat);
TestSuite subSuite = new TestSuite(subManifest.substring(HOST.length()));
logger.info("Creating test cases for {}", subManifest);
TupleQueryResult tests = con.prepareTupleQuery(QueryLanguage.SERQL, TESTCASE_QUERY).evaluate();
while (tests.hasNext()) {
BindingSet bindingSet = tests.next();
String testURI = bindingSet.getValue("TestURI").toString();
String testName = bindingSet.getValue("Name").toString();
String testAction = bindingSet.getValue("Action").toString();
boolean positiveTest = bindingSet.getValue("Type").toString().equals(
"http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#PositiveSyntaxTest");
subSuite.addTest(new SPARQLSyntaxTest(testURI, testName, testAction, positiveTest));
}
tests.close();
suite.addTest(subSuite);
}
con.close();