@Test public void testJsonLdDefaultSerializer() throws UnsupportedEncodingException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); service3.write(getTriples(), out, JSONLD); final String output = out.toString("UTF-8"); final Graph graph = rdf.createGraph(); service3.read(new ByteArrayInputStream(output.getBytes(UTF_8)), JSONLD, null).forEach(graph::add); assertAll("Check compact serialization", checkCompactSerialization(output, graph)); }
@Test public void testJsonLdCompactedSerializer() throws UnsupportedEncodingException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); service.write(getTriples(), out, JSONLD, compacted); final String output = out.toString("UTF-8"); final Graph graph = rdf.createGraph(); service.read(new ByteArrayInputStream(output.getBytes(UTF_8)), JSONLD, null).forEach(graph::add); assertAll("Check compact serialization", checkCompactSerialization(output, graph)); }
@Test public void testJsonLdCustomUnrecognizedSerializer3() throws UnsupportedEncodingException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); service.write(getTriples(), out, JSONLD, rdf.createIRI("http://www.trellisldp.org/ns/nonexistent.jsonld")); final String output = out.toString("UTF-8"); final Graph graph = rdf.createGraph(); service.read(new ByteArrayInputStream(output.getBytes(UTF_8)), JSONLD, null).forEach(graph::add); assertAll("Check compact serialization", checkCompactSerialization(output, graph)); }
@Test public void testJsonLdCustomUnrecognizedSerializer() throws UnsupportedEncodingException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); service.write(getTriples(), out, JSONLD, rdf.createIRI("http://www.example.org/context.jsonld")); final String output = out.toString("UTF-8"); final Graph graph = rdf.createGraph(); service.read(new ByteArrayInputStream(output.getBytes(UTF_8)), JSONLD, null).forEach(graph::add); assertAll("Check compact serialization", checkCompactSerialization(output, graph)); }
@Test public void testJsonLdCustomUnrecognizedSerializer2() throws UnsupportedEncodingException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); service2.write(getTriples(), out, JSONLD, rdf.createIRI("http://www.example.org/context.jsonld")); final String output = out.toString("UTF-8"); final Graph graph = rdf.createGraph(); service2.read(new ByteArrayInputStream(output.getBytes(UTF_8)), JSONLD, null).forEach(graph::add); assertAll("Check compact serialization", checkCompactSerialization(output, graph)); }
@Test public void testJsonLdNullCache() throws UnsupportedEncodingException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final IOService myservice = new JenaIOService(); myservice.write(getTriples(), out, JSONLD, rdf.createIRI("http://www.w3.org/ns/anno.jsonld")); final String output = out.toString("UTF-8"); final Graph graph = rdf.createGraph(); myservice.read(new ByteArrayInputStream(output.getBytes(UTF_8)), JSONLD, null).forEach(graph::add); assertAll("Check compact serialization", checkCompactSerialization(output, graph)); }