use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testIRIRules_2a.
public void testIRIRules_2a() {
Model model = ModelFactory.createDefaultModel();
RDFReader r = model.getReader("RDF/XML");
r.setErrorHandler(this);
expected = new int[] {};
model.read(new StringReader(RDF_TEXT), "http://example/");
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class MoreTests method testBadBaseParamOK.
public void testBadBaseParamOK() 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 };
rdr.read(m, fin, "http://jjc^3.org/demo.mp3");
}
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 TestTurtle method runTest.
@Override
public void runTest() {
Model model = ModelFactory.createDefaultModel();
RDFReader t = new TurtleReader();
try {
if (baseIRI != null)
t.read(model, FileManager.get().open(input), baseIRI);
else
t.read(model, input);
// "http://www.w3.org/2001/sw/DataAccess/df1/tests/rdfq-results.ttl"
String syntax = FileUtils.guessLang(output, FileUtils.langNTriple);
Model results = FileManager.get().loadModel(output, syntax);
boolean b = model.isIsomorphicWith(results);
if (!b)
assertTrue("Models not isomorphic", b);
} catch (TurtleParseException ex) {
throw ex;
}
}
use of org.apache.jena.rdf.model.RDFReader in project jena by apache.
the class TestReaders method testGetNTripleReader.
/**
* Test to ensure that the reader is set.
*/
public void testGetNTripleReader() {
final RDFReader reader = model.getReader("N-TRIPLE");
Assert.assertNotNull(reader);
}
Aggregations