use of org.apache.jena.n3.turtle.TurtleParseException in project jena by apache.
the class ParserTurtle method parse.
public void parse(Graph graph, String baseURI, Reader reader) {
// Nasty things happen if the reader is not UTF-8.
try {
TurtleParser parser = new TurtleParser(reader);
parser.setEventHandler(new TurtleRDFGraphInserter(graph));
parser.setBaseURI(baseURI);
parser.parse();
} catch (ParseException | TokenMgrError ex) {
throw new TurtleParseException(ex.getMessage());
} catch (TurtleParseException ex) {
throw ex;
} catch (Throwable th) {
throw new TurtleParseException(th.getMessage(), th);
}
}
use of org.apache.jena.n3.turtle.TurtleParseException 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;
}
}
Aggregations