use of org.apache.jena.riot.RiotException in project jena by apache.
the class UnitTestBadSyntax method run4.
private void run4() {
Dataset ds = DatasetFactory.createGeneral();
try {
RDFDataMgr.read(ds, uri, uri, lang);
} catch (RiotException ex) {
return;
} catch (RuntimeException ex) {
ex.printStackTrace(System.err);
fail("Unexpected exception");
}
fail("Bad syntax test succeed in parsing the file");
}
use of org.apache.jena.riot.RiotException in project jena by apache.
the class UnitTestEval method run4.
private void run4() {
DatasetGraph dsg = DatasetGraphFactory.create();
try {
if (baseIRI != null)
RDFDataMgr.read(dsg, input, baseIRI, lang);
else
RDFDataMgr.read(dsg, input, lang);
Lang outLang = RDFLanguages.filenameToLang(output, Lang.NQUADS);
DatasetGraph results = DatasetGraphFactory.create();
try {
RDFDataMgr.read(results, output, outLang);
} catch (RiotException ex) {
fail("Failed to read results: " + ex.getMessage());
}
boolean b = isomorphic(dsg, results);
if (!b) {
System.out.println("**** Test: " + getName());
System.out.println("---- Parsed");
RDFDataMgr.write(System.out, dsg, Lang.TRIG);
System.out.println("---- Expected");
RDFDataMgr.write(System.out, results, Lang.TRIG);
System.out.println("--------");
}
assertTrue("Datasets not isomorphic", b);
} catch (RiotException ex) {
// Catch and rethrow - debugging.
throw ex;
} catch (RuntimeException ex) {
ex.printStackTrace(System.err);
throw ex;
}
}
use of org.apache.jena.riot.RiotException in project jena by apache.
the class UnitTestEval method run3.
// Triples test.
private void run3() {
Model model = ModelFactory.createDefaultModel();
try {
if (baseIRI != null)
RDFDataMgr.read(model, input, baseIRI, lang);
else
RDFDataMgr.read(model, input, lang);
Lang outLang = RDFLanguages.filenameToLang(output, Lang.NQUADS);
Model results = ModelFactory.createDefaultModel();
try {
RDFDataMgr.read(results, output, outLang);
} catch (RiotException ex) {
fail("Failed to read results: " + ex.getMessage());
}
boolean b = model.isIsomorphicWith(results);
if (!b) {
//model.isIsomorphicWith(results) ;
System.out.println("---- Parsed");
model.write(System.out, "TTL");
System.out.println("---- Expected");
results.write(System.out, "TTL");
System.out.println("--------");
}
assertTrue("Models not isomorphic", b);
} catch (RiotException ex) {
// Catch and rethrow - debugging.
throw ex;
} catch (RuntimeException ex) {
ex.printStackTrace(System.err);
throw ex;
}
}
Aggregations