use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class ExceptionTests method testDefaultPromotedWarning.
public void testDefaultPromotedWarning() {
RDFDefaultErrorHandler.silent = true;
try {
Model m = ModelFactory.createDefaultModel();
RDFReader rdr = m.getReader();
rdr.setProperty("WARN_BAD_NAME", "EM_FATAL");
rdr.read(m, "file:testing/arp/qname-in-ID/bug74_0.rdf");
fail("Promoted warning did not throw exception");
} catch (JenaException e) {
} finally {
RDFDefaultErrorHandler.silent = false;
}
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class ExceptionTests method testNonExceptionFatal.
public void testNonExceptionFatal() {
try {
Model m = ModelFactory.createDefaultModel();
RDFReader rdr = m.getReader();
rdr.setErrorHandler(this);
rdr.read(m, "file:testing/arp/error-msgs/test06.rdf");
} catch (JenaException e) {
fail("Fatal error threw an exception with non-exception handler");
}
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testNullBaseParamOK.
public void testNullBaseParamOK() throws IOException {
Model m = createMemModel();
Model m1 = createMemModel();
RDFReader rdr = m.getReader();
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-identity-anon-resources/test001.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] {};
rdr.read(m, fin, "http://example.org/");
}
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-identity-anon-resources/test001.rdf")) {
rdr.read(m1, fin, null);
}
assertTrue("Base URI should have no effect.", m.isIsomorphicWith(m1));
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testIRIRules_4.
public void testIRIRules_4() {
Model model = ModelFactory.createDefaultModel();
RDFReader r = model.getReader("RDF/XML");
r.setProperty("iri-rules", "strict");
r.setProperty("WARN_MALFORMED_URI", ARPErrorNumbers.EM_ERROR);
r.setErrorHandler(this);
// Errors actually continue.
expected = new int[] { WARN_MALFORMED_URI, WARN_MALFORMED_URI };
r.read(model, new StringReader(RDF_TEXT), "http://example/");
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testEncodingMismatch1.
public void testEncodingMismatch1() throws IOException {
Model m = createMemModel();
RDFReader rdr = m.getReader();
try (FileReader r = new FileReader("testing/wg/rdfms-syntax-incomplete/test001.rdf")) {
if (r.getEncoding().startsWith("UTF")) {
//logger.warn("Encoding mismatch tests not executed on platform with default UTF encoding.");
r.close();
return;
}
rdr.setErrorHandler(this);
expected = new int[] { WARN_ENCODING_MISMATCH };
rdr.read(m, r, "http://example.org/");
//System.err.println(m.size() + " triples read.");
checkExpected();
}
}
Aggregations