use of org.apache.jena.rdf.model.impl.RDFWriterFImpl 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();
}
use of org.apache.jena.rdf.model.impl.RDFWriterFImpl in project jena by apache.
the class rdfcat method getCheckedLanguage.
/**
Answer the full, checked, language name expanded from <code>shortName</code>.
The shortName is expanded according to the table of abbreviations [below].
It is then checked against RDFWriterFImpl's writer table [this is hacky but
at the moment it's the most available interface] and the NoWriter exception
trapped and replaced by the original IllegalArgument exception.
*/
public static String getCheckedLanguage(String shortLang) {
String fullLang = unabbreviate.get(shortLang);
String tryLang = (fullLang == null ? shortLang : fullLang);
try {
new RDFWriterFImpl().getWriter(tryLang);
} catch (NoWriterForLangException e) {
throw new IllegalArgumentException("'" + shortLang + "' is not recognised as a legal output format");
}
return tryLang;
}
use of org.apache.jena.rdf.model.impl.RDFWriterFImpl 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());
}
Aggregations