use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testIRIRules_3.
public void testIRIRules_3() {
Model model = ModelFactory.createDefaultModel();
RDFReader r = model.getReader("RDF/XML");
r.setErrorHandler(this);
expected = new int[] { WARN_MALFORMED_URI, WARN_MALFORMED_URI };
r.setProperty("iri-rules", "strict");
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 testBadBaseParamError.
public void testBadBaseParamError() throws IOException {
Model m = createMemModel();
RDFReader rdr = m.getReader();
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-difference-between-ID-and-about/test1.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] { WARN_MALFORMED_URI, WARN_MALFORMED_URI, // WARN_RELATIVE_URI, ERR_RESOLVING_AGAINST_MALFORMED_BASE};
ERR_RESOLVING_AGAINST_MALFORMED_BASE };
rdr.read(m, fin, "http://jjc^3.org/demo.mp3");
}
Model m1 = createMemModel();
assertTrue("Bad base URI should produce no URIs in model.[" + m.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testNullBaseParamError.
public void testNullBaseParamError() throws IOException {
Model m = createMemModel();
RDFReader rdr = m.getReader();
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-difference-between-ID-and-about/test1.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] { ERR_RESOLVING_URI_AGAINST_NULL_BASE, WARN_RELATIVE_URI };
rdr.read(m, fin, null);
}
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testRelativeBaseParamError.
public void testRelativeBaseParamError() throws IOException {
Model m = createMemModel();
RDFReader rdr = m.getReader();
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-difference-between-ID-and-about/test1.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] { WARN_RELATIVE_URI, WARN_RELATIVE_URI, ERR_RESOLVING_AGAINST_RELATIVE_BASE };
rdr.setProperty("ERR_RESOLVING_AGAINST_RELATIVE_BASE", "EM_WARNING");
rdr.read(m, fin, "foo/");
}
Model m1 = createMemModel();
m1.createResource("foo/#foo").addProperty(RDF.value, "abc");
assertTrue("Relative base URI should produce relative URIs in model (when error suppressed).[" + m.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testEmptyBaseParamError.
public void testEmptyBaseParamError() throws IOException {
Model m = createMemModel();
RDFReader rdr = m.getReader();
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-difference-between-ID-and-about/test1.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] { WARN_RESOLVING_URI_AGAINST_EMPTY_BASE };
rdr.read(m, fin, "");
}
Model m1 = createMemModel();
m1.createResource("#foo").addProperty(RDF.value, "abc");
assertTrue("Empty base URI should produce relative URI.[" + m.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
Aggregations