private static RDFFormat chooseFormat(RDFFormat format, Lang lang) { if ( format != null ) return format; if ( lang == null ) //throw new RiotException("No syntax for output") ; return null; format = RDFWriterRegistry.defaultSerialization(lang); return format; }
/** Write the DatasetGraph to the output stream in the default serialization for the language. * @param out OutputStream * @param dataset DatasetGraph to write * @param lang Language for the seralization. */ public static void write(OutputStream out, DatasetGraph dataset, Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ; write(out, dataset, serialization) ; }
private static boolean datasetWriterExistsForLang(Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ; WriterDatasetRIOTFactory wf = RDFWriterRegistry.getWriterDatasetFactory(serialization) ; return wf != null; }
/** Write the graph to the output stream in the default serialization for the language. * @param out OutputStream * @param graph Graph to write * @param lang Language for the seralization. */ public static void write(OutputStream out, Graph graph, Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ; write(out, graph, serialization) ; }
/** Create a writer for an RDF language * @param lang Language for the seralization. * @return WriterGraphRIOT */ public static WriterGraphRIOT createGraphWriter(Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ; return createGraphWriter$(serialization) ; }
/** Map {@link Lang} to {@link RDFFormat}, or throw an exception. */ private static RDFFormat langToFormatOrException(Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang); if ( serialization == null ) throw new RiotException("No output format for "+lang) ; return serialization ; }
/** Write the graph to the output stream in the default serialization for the language. * @param out StringWriter * @param graph Graph to write * @param lang Serialization format */ public static void write(StringWriter out, Graph graph, Lang lang) { // Only known reasonable use of a Writer write$(out, graph, RDFWriterRegistry.defaultSerialization(lang)) ; }
/** Write the DatasetGraph to the output stream in the default serialization for the language. * @param out StringWriter * @param dataset DatasetGraph to write * @param lang Language for the seralization. */ public static void write(StringWriter out, DatasetGraph dataset, Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ; write(out, dataset, serialization) ; }
/** Create a writer for an RDF language * @param lang Language for the seralization. * @return WriterGraphRIOT */ public static WriterDatasetRIOT createDatasetWriter(Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ; return createDatasetWriter$(serialization) ; }
/** Get the dataset writer factory associated with the language */ public static WriterDatasetRIOTFactory getWriterDatasetFactory(Lang lang) { RDFFormat serialization = defaultSerialization(lang) ; if ( serialization == null ) throw new RiotException("No default serialization for language " + lang) ; return getWriterDatasetFactory(serialization) ; }
@SuppressWarnings("deprecation") @Override protected void writeOutput(Writer writer) { RDFDataMgr.write(writer, this.g, RDFWriterRegistry.defaultSerialization(this.getRdfLanguage())); }
/** Get the graph writer factory associated with the language */ public static WriterGraphRIOTFactory getWriterGraphFactory(Lang lang) { RDFFormat serialization = defaultSerialization(lang) ; if ( serialization == null ) throw new RiotException("No default serialization for language " + lang) ; return getWriterGraphFactory(serialization) ; }
/** Write the graph to the output stream in the default serialization for the language. * @param out StringWriter * @param dataset Dataset to write * @param lang Language for the seralization. */ public static void write(StringWriter out, Dataset dataset, Lang lang) { RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ; write$(out, dataset.asDatasetGraph(), serialization) ; }
/** Get the graph writer factory asscoiated with the language */ public static WriterGraphRIOTFactory getWriterGraphFactory(Lang lang) { RDFFormat serialization = defaultSerialization(lang) ; if ( serialization == null ) throw new RiotException("No default serialization for language "+lang) ; return getWriterGraphFactory(serialization) ; }
@SuppressWarnings("deprecation") @Override protected void writeOutput(Writer writer) { RDFDataMgr.write(writer, this.g, RDFWriterRegistry.defaultSerialization(this.getRdfLanguage())); }
/** Set the output format for sending RDF graphs to the remote server. * This is used for the SPARQ Graph Store Protocol. */ public RDFConnectionRemoteBuilder triplesFormat(Lang langTriples) { Objects.requireNonNull(langTriples); if ( ! RDFLanguages.isTriples(langTriples) ) throw new RiotException("Not a language for RDF triples: "+langTriples); RDFFormat fmt = RDFWriterRegistry.defaultSerialization(langTriples); if ( fmt == null ) throw new RiotException("Language name not recognized: "+langTriples); triplesFormat(fmt); return this; }
@Override public void writeTo(Writer writer, Syntax syntax) { assertModel(); registerNamespaces(this.jenaModel); RDFDataMgr.write(writer, this.jenaModel, RDFWriterRegistry.defaultSerialization(getJenaLang(syntax))); }
@Test public void jenaSystem_write_2() { if ( istriples ) assertNotNull(RDFWriterRegistry.getWriterGraphFactory(lang)) ; if ( isquads ) assertNotNull(RDFWriterRegistry.getWriterDatasetFactory(lang)) ; assertNotNull(RDFWriterRegistry.defaultSerialization(lang)) ; }
@Test public void jenaSystem_write_2() { assertNotNull(RDFWriterRegistry.getWriterGraphFactory(JenaJSONLD.JSONLD)); assertNotNull(RDFWriterRegistry.getWriterDatasetFactory(JenaJSONLD.JSONLD)); assertNotNull(RDFWriterRegistry.defaultSerialization(JenaJSONLD.JSONLD)); }
@Test public void jenaSystem_write_3() { assertEquals(jsonldFmt1, RDFWriterRegistry.defaultSerialization(JenaJSONLD.JSONLD)); assertNotNull(RDFWriterRegistry.getWriterGraphFactory(jsonldFmt1)); assertNotNull(RDFWriterRegistry.getWriterGraphFactory(jsonldFmt2)); assertTrue(RDFWriterRegistry.registeredGraphFormats().contains(jsonldFmt1)); assertTrue(RDFWriterRegistry.registeredGraphFormats().contains(jsonldFmt2)); assertNotNull(RDFWriterRegistry.getWriterDatasetFactory(jsonldFmt1)); assertNotNull(RDFWriterRegistry.getWriterDatasetFactory(jsonldFmt2)); assertTrue(RDFWriterRegistry.registeredDatasetFormats().contains(jsonldFmt1)); assertTrue(RDFWriterRegistry.registeredDatasetFormats().contains(jsonldFmt2)); }