RDFReader
519520521522523524525526527
private Model parseToModelNTriples(String string) { StringReader r = new StringReader(string) ; Model model = ModelFactory.createDefaultModel() ; RDFReader reader = new JenaReaderNTriples2() ; reader.read(model, r, null) ; return model ; }
528529530531532533534535536
private Model parseToModelRdfJson(String string) { StringReader r = new StringReader(string) ; Model model = ModelFactory.createDefaultModel() ; RDFReader reader = new JenaReaderRdfJson() ; reader.read(model, r, null) ; return model ; }
34353637383940414243444546
@Override public void runTest() { Model model = ModelFactory.createDefaultModel() ; RDFReader t = new JenaReaderTurtle2() ; try { t.read(model, uri) ; } catch (RiotParseException ex) { throw ex ; } }
4849505152535455565758596061626364
{ String s = "_:a <p> 'foo' . " ; StringReader r = new StringReader(s) ; Model m = ModelFactory.createDefaultModel() ; RDFReader reader = new JenaReaderNTriples2() ; reader.read(m, r, null) ; assertEquals(1, m.size()) ; String x = m.listStatements().next().getSubject().getId().getLabelString() ; assertNotEquals(x, "a") ; // reset - reread - new bNode. r = new StringReader(s) ; reader.read(m, r, null) ; assertEquals(2, m.size()) ; }
117118119120121122123124125
protected Model parseToModel(String string) { StringReader r = new StringReader(string) ; Model model = ModelFactory.createDefaultModel() ; RDFReader reader = new JenaReaderNTriples2() ; reader.read(model, r, null) ; return model ; }
5051525354555657585960616263646566676869
@Override public void runTest() { Model model = ModelFactory.createDefaultModel() ; RDFReader t = new JenaReaderTurtle2() ; try { if ( baseIRI != null ) { InputStream in = FileManager.get().open(input) ; Reader r = PeekReader.makeUTF8(in) ; t.read(model, r, 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);
5051525354555657585960616263646566
{ String s = "_:a <http://example/p> 'foo' . " ; StringReader r = new StringReader(s) ; Model m = ModelFactory.createDefaultModel() ; RDFReader reader = new JenaReaderTurtle2() ; readProtected(reader,m, r, null) ; assertEquals(1, m.size()) ; String x = m.listStatements().next().getSubject().getId().getLabelString() ; assertNotEquals(x, "a") ; // reset - reread - new bNode. r = new StringReader(s) ; reader.read(m, r, null) ; assertEquals(2, m.size()) ; }
697071727374757677
{ // Duplicate. String s = "_:a <http://example/p> 'foo' . _:a <http://example/p> 'foo' ." ; StringReader r = new StringReader(s) ; Model m = ModelFactory.createDefaultModel() ; RDFReader reader = new JenaReaderTurtle2() ; readProtected(reader,m, r, null) ; assertEquals(1, m.size()) ; }
6162636465666768697071727374757677787980
} private void testJenaReaderRdfJson() { Model model = ModelFactory.createDefaultModel() ; RDFReader t = new JenaReaderRdfJson() ; try { if ( baseIRI != null ) { InputStream in = FileManager.get().open(input) ; Reader r = PeekReader.makeUTF8(in) ; t.read(model, r, baseIRI) ; } else t.read(model, input) ; Model results = FileManager.get().loadModel(output) ; boolean b = model.isIsomorphicWith(results) ; if ( !b )