Search in sources :

Example 1 with RDFWriterF

use of org.apache.jena.rdf.model.RDFWriterF in project jena by apache.

the class TestIO_JenaWriters method testResetJena.

@Test
public void testResetJena() {
    IO_Jena.wireIntoJena();
    IO_Jena.resetJena();
    RDFWriterF writerF = new RDFWriterFImpl();
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter().getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter("RDF/XML").getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter("RDF/XML-ABBREV").getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter("N-TRIPLE").getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter("N-Triples").getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter("N-TRIPLE").getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter("N3").getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterPrettyPrinter).getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterPlain).getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterTriples).getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterTriplesAlt).getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.turtleWriter).getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.turtleWriterAlt1).getClass());
    assertNotEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.turtleWriterAlt2).getClass());
    try {
        writerF.getWriter("NT");
        fail("Exception expected");
    } catch (NoWriterForLangException ex) {
    }
    try {
        writerF.getWriter("RDF/JSON");
        fail("Exception expected");
    } catch (NoWriterForLangException ex) {
    }
    try {
        writerF.getWriter("RDFJSON");
        fail("Exception expected");
    } catch (NoWriterForLangException ex) {
    }
    IO_Jena.wireIntoJena();
}
Also used : RDFWriterFImpl(org.apache.jena.rdf.model.impl.RDFWriterFImpl) RDFWriterF(org.apache.jena.rdf.model.RDFWriterF) NoWriterForLangException(org.apache.jena.shared.NoWriterForLangException) Test(org.junit.Test)

Example 2 with RDFWriterF

use of org.apache.jena.rdf.model.RDFWriterF in project jena by apache.

the class TestIO_JenaWriters method testWireIntoJena.

@Test
public void testWireIntoJena() {
    IO_Jena.wireIntoJena();
    RDFWriterF writerF = new RDFWriterFImpl();
    assertEquals(RDFWriterRIOT.class, writerF.getWriter().getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("RDF/XML").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("RDF/XML-ABBREV").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("N-TRIPLE").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("N-Triples").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("N-TRIPLE").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("NT").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("N3").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterPrettyPrinter).getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterPlain).getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterTriples).getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.n3WriterTriplesAlt).getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.turtleWriter).getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.turtleWriterAlt1).getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter(N3JenaWriter.turtleWriterAlt2).getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("RDF/JSON").getClass());
    assertEquals(RDFWriterRIOT.class, writerF.getWriter("RDFJSON").getClass());
}
Also used : RDFWriterFImpl(org.apache.jena.rdf.model.impl.RDFWriterFImpl) RDFWriterF(org.apache.jena.rdf.model.RDFWriterF) Test(org.junit.Test)

Example 3 with RDFWriterF

use of org.apache.jena.rdf.model.RDFWriterF in project jena by apache.

the class TestRDFWriterMap method testWritersPresent.

public void testWritersPresent() {
    final RDFWriterF x = new RDFWriterMap(true);
    Assert.assertEquals(N3TurtleJenaWriter.class, x.getWriter(TestRDFWriterMap.TURTLE_WRITER).getClass());
    Assert.assertEquals(N3TurtleJenaWriter.class, x.getWriter(TestRDFWriterMap.TURTLE_WRITER_ALT1).getClass());
    Assert.assertEquals(N3TurtleJenaWriter.class, x.getWriter(TestRDFWriterMap.TURTLE_WRITER_ALT2).getClass());
    Assert.assertEquals(Basic.class, x.getWriter(TestRDFWriterMap.RDF_XML).getClass());
    Assert.assertEquals(Abbreviated.class, x.getWriter(TestRDFWriterMap.RDF_XML_ABBREV).getClass());
    Assert.assertEquals(NTripleWriter.class, x.getWriter(TestRDFWriterMap.NTRIPLE).getClass());
    Assert.assertEquals(NTripleWriter.class, x.getWriter(TestRDFWriterMap.NTRIPLES).getClass());
    Assert.assertEquals(N3JenaWriter.class, x.getWriter(TestRDFWriterMap.N3).getClass());
    Assert.assertEquals(N3JenaWriterPP.class, x.getWriter(TestRDFWriterMap.N3_PP).getClass());
    Assert.assertEquals(N3JenaWriterPlain.class, x.getWriter(TestRDFWriterMap.N3_PLAIN).getClass());
    Assert.assertEquals(N3JenaWriterTriples.class, x.getWriter(TestRDFWriterMap.N3_TRIPLE).getClass());
    Assert.assertEquals(N3JenaWriterTriples.class, x.getWriter(TestRDFWriterMap.N3_TRIPLES).getClass());
}
Also used : RDFWriterF(org.apache.jena.rdf.model.RDFWriterF)

Example 4 with RDFWriterF

use of org.apache.jena.rdf.model.RDFWriterF in project jena by apache.

the class TestRDFWriterMap method testDefaultWriter.

public void testDefaultWriter() {
    final RDFWriterF x = new RDFWriterMap(true);
    Assert.assertEquals(x.getWriter("RDF/XML").getClass(), x.getWriter().getClass());
}
Also used : RDFWriterF(org.apache.jena.rdf.model.RDFWriterF)

Aggregations

RDFWriterF (org.apache.jena.rdf.model.RDFWriterF)4 RDFWriterFImpl (org.apache.jena.rdf.model.impl.RDFWriterFImpl)2 Test (org.junit.Test)2 NoWriterForLangException (org.apache.jena.shared.NoWriterForLangException)1