use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testEmptyBaseParamOK.
public void testEmptyBaseParamOK() 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, "");
}
assertTrue("Empty base URI should have no effect.[" + m1.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testIRIRules_2.
public void testIRIRules_2() {
Model model = ModelFactory.createDefaultModel();
IRIFactory f = ARPOptions.getIRIFactoryGlobal();
try {
ARPOptions.setIRIFactoryGlobal(IRIFactory.iriImplementation());
RDFReader r = model.getReader("RDF/XML");
expected = new int[] { WARN_MALFORMED_URI, WARN_MALFORMED_URI };
r.setErrorHandler(this);
r.read(model, new StringReader(RDF_TEXT), "http://example/");
} finally {
ARPOptions.setIRIFactoryGlobal(f);
}
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testBaseTruncation.
public void testBaseTruncation() 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[] { WARN_MALFORMED_URI, WARN_RELATIVE_URI };
rdr.read(m, fin, "ht#tp://jjc3.org/demo.mp3#frag");
}
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.[" + m1.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testRelativeBaseParamOK.
public void testRelativeBaseParamOK() 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[] { 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.RDFReader in project jena by apache.
the class TestReaderEvents method testReaderEvent.
public void testReaderEvent(final String language, final String emptyModel) {
final RecordingModelListener L = new RecordingModelListener();
model.register(L);
final RDFReader r = model.getReader(language);
final StringReader stringReader = new StringReader(emptyModel);
r.read(model, stringReader, "");
L.assertHasStart(new Object[] { "someEvent", model, GraphEvents.startRead });
L.assertHasEnd(new Object[] { "someEvent", model, GraphEvents.finishRead });
}
Aggregations