use of org.apache.jena.rdf.model.Model in project jena by apache.
the class QueryTest method createDataset.
private static Dataset createDataset(List<String> defaultGraphURIs, List<String> namedGraphURIs) {
// Allow "qt:data" to be quads in defaultGraphURIs.
Dataset ds = DatasetFactory.createGeneral();
if (defaultGraphURIs != null) {
for (String sourceURI : defaultGraphURIs) {
RDFDataMgr.read(ds, sourceURI);
}
}
if (namedGraphURIs != null) {
for (String sourceURI : namedGraphURIs) {
String absSourceURI = IRIResolver.resolveString(sourceURI);
Model m = ds.getNamedModel(absSourceURI);
RDFDataMgr.read(m, sourceURI);
}
}
return ds;
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class QueryTest method compareGraphResults.
private void compareGraphResults(Model resultsActual, Query query) {
if (results != null) {
try {
if (!results.isGraph())
fail("Expected results are not a graph: " + testItem.getName());
Model resultsExpected = results.getModel();
if (!resultsExpected.isIsomorphicWith(resultsActual)) {
printFailedModelTest(query, resultsExpected, resultsActual);
fail("Results do not match: " + testItem.getName());
}
} catch (Exception ex) {
String typeName = (query.isConstructType() ? "construct" : "describe");
fail("Exception in result testing (" + typeName + "): " + ex);
}
}
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class QueryTest method runTestDescribe.
void runTestDescribe(Query query, QueryExecution qe) {
Model resultsActual = qe.execDescribe();
compareGraphResults(resultsActual, query);
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class UpdateTest method datasetSame.
private boolean datasetSame(Dataset ds1, Dataset ds2, boolean verbose) {
List<String> names1 = Iter.toList(ds1.listNames());
List<String> names2 = Iter.toList(ds2.listNames());
if (!names1.equals(names2)) {
if (verbose) {
System.out.println("Different named graphs");
System.out.println(" " + names1);
System.out.println(" " + names2);
}
return false;
}
if (!ds1.getDefaultModel().isIsomorphicWith(ds2.getDefaultModel())) {
if (verbose)
System.out.println("Default graphs differ");
return false;
}
for (String gn : names1) {
Model m1 = ds1.getNamedModel(gn);
Model m2 = ds2.getNamedModel(gn);
if (!m1.isIsomorphicWith(m2)) {
if (verbose)
System.out.println("Different on named graph " + gn);
return false;
}
}
return true;
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class rdflangtest method oneManifestEarl.
static void oneManifestEarl(String testManifest) {
EarlReport report = new EarlReport(systemURI, name, version, homepage);
FactoryTestRiot.report = report;
TestSuite suite = FactoryTestRiot.make(testManifest, null, null);
SimpleTestRunner.runSilent(suite);
Model model = report.getModel();
model.setNsPrefix("rdft", VocabLangRDF.getURI());
model.setNsPrefix("turtletest", "http://www.w3.org/2013/TurtleTests/manifest.ttl#");
insertMetaOld(report);
RDFDataMgr.write(System.out, model, Lang.TURTLE);
}
Aggregations