本文整理匯總了Java中org.openrdf.rio.Rio.getWriterFormatForMIMEType方法的典型用法代碼示例。如果您正苦於以下問題:Java Rio.getWriterFormatForMIMEType方法的具體用法?Java Rio.getWriterFormatForMIMEType怎麽用?Java Rio.getWriterFormatForMIMEType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openrdf.rio.Rio
的用法示例。
在下文中一共展示了Rio.getWriterFormatForMIMEType方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createWriter
import org.openrdf.rio.Rio; //導入方法依賴的package包/類
private RDFWriter createWriter(StringWriter writer) {
RDFWriter result=null;
if(format.equals(Format.TURTLE)) {
result=new TurtlePrettyPrinter(new MemValueFactory().createURI(baseURI.toString()),writer);
} else {
RDFWriterRegistry registry=RDFWriterRegistry.getInstance();
RDFFormat rawFormat=Rio.getWriterFormatForMIMEType(format.getMime(),RDFFormat.RDFXML);
RDFWriterFactory factory=registry.get(rawFormat);
result=factory.getWriter(writer);
if(format.equals(Format.JSON_LD)) {
result.getWriterConfig().set(JSONLDSettings.JSONLD_MODE,JSONLDMode.FLATTEN);
result.getWriterConfig().set(BasicWriterSettings.PRETTY_PRINT,true);
}
}
return result;
}
示例2: getFormat
import org.openrdf.rio.Rio; //導入方法依賴的package包/類
private RDFFormat getFormat() {
return Rio.getWriterFormatForMIMEType(format.getMime(), RDFFormat.TURTLE);
}
示例3: SPARQLGraphResultWriter
import org.openrdf.rio.Rio; //導入方法依賴的package包/類
public SPARQLGraphResultWriter(OutputStream outputStream, String mimeType) {
this.outputStream = outputStream;
this.format = Rio.getWriterFormatForMIMEType(mimeType, RDFFormat.RDFXML);
}
示例4: getSerializer
import org.openrdf.rio.Rio; //導入方法依賴的package包/類
/**
* returns a serializer for a given mimetype; null if no serializer defined
* @param mimetype
* @return
*/
@Override
public RDFFormat getSerializer(String mimetype) {
return Rio.getWriterFormatForMIMEType(mimetype);
}