use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class MoreTests method testEmptyBaseParamError.
public void testEmptyBaseParamError() throws IOException {
Model m = createMemModel();
RDFReaderI 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();
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class MoreTests method testEmptyBaseParamOK.
public void testEmptyBaseParamOK() throws IOException {
Model m = createMemModel();
Model m1 = createMemModel();
RDFReaderI 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, "");
}
assertTrue("Empty base URI should have no effect.[" + m1.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class MoreTests method testRelativeBaseParamOK.
public void testRelativeBaseParamOK() throws IOException {
Model m = createMemModel();
Model m1 = createMemModel();
RDFReaderI rdr = m.getReader();
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-identity-anon-resources/test001.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] { WARN_RELATIVE_URI };
rdr.read(m, fin, "foo/");
}
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-identity-anon-resources/test001.rdf")) {
rdr.read(m1, fin, "");
}
assertTrue("Bad base URI should have no effect on model.[" + m1.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class MoreTests method testIRIRules_3.
public void testIRIRules_3() {
Model model = ModelFactory.createDefaultModel();
RDFReaderI 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.RDFReaderI in project jena by apache.
the class MoreTests method testNullBaseParamError.
public void testNullBaseParamError() throws IOException {
Model m = createMemModel();
RDFReaderI 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();
}
Aggregations