use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestLangRdfJson method rdfjson_read_bnode_identity2.
@Test
public void rdfjson_read_bnode_identity2() {
String s = "{ \"http://example.org/subject\" : { \"http://example.org/predicate\" : [ { \"type\" : \"bnode\" , \"value\" : \"_:id\" } ] , \"http://example.org/predicate2\" : [ { \"type\" : \"bnode\" , \"value\" : \"_:id\" } ] } }";
String s2 = "<http://example.org/subject> <http://example.org/predicate> _:id ." + "<http://example.org/subject> <http://example.org/predicate2> _:id .";
assertEquals(2, parseCount(s));
Model m = parseToModelRdfJson(s);
Model m2 = parseToModelNTriples(s2);
assertTrue(m.isIsomorphicWith(m2));
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestLangRdfJson method parseToModelNTriples.
private Model parseToModelNTriples(String string) {
StringReader r = new StringReader(string);
Model model = ModelFactory.createDefaultModel();
RDFDataMgr.read(model, r, null, RDFLanguages.NTRIPLES);
return model;
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestLangRdfJson method rdfjson_read_objectlist_literals3.
@Test
public void rdfjson_read_objectlist_literals3() {
String s = "{ \"http://example.org/subject\" : { \"http://example.org/predicate\" : [ { \"type\" : \"literal\" , \"value\" : \"some text\" } , { \"type\" : \"literal\" , \"value\" : \"more text\", \"datatype\" : \"http://example.org/datatype\" } ] } }";
String s2 = "<http://example.org/subject> <http://example.org/predicate> \"some text\" .\n" + "<http://example.org/subject> <http://example.org/predicate> \"more text\"^^<http://example.org/datatype> .";
assertEquals(2, parseCount(s));
Model m = parseToModelRdfJson(s);
Model m2 = parseToModelNTriples(s2);
assertTrue(m.isIsomorphicWith(m2));
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestLangRdfJson method rdfjson_get_jena_writer.
@Test
public void rdfjson_get_jena_writer() {
Model m = ModelFactory.createDefaultModel();
m.getWriter("RDF/JSON");
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestLangRdfJson method rdfjson_get_jena_reader.
@Test
public void rdfjson_get_jena_reader() {
Model m = ModelFactory.createDefaultModel();
m.getReader("RDF/JSON");
}
Aggregations