org.openrdf.rio.Rio.createWriter()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.openrdf.rio.Rio.createWriter方法的一些代码示例,展示了Rio.createWriter的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rio.createWriter方法的具体详情如下:
包路径:org.openrdf.rio.Rio
类名称:Rio
方法名:createWriter

Rio.createWriter介绍

[英]Convenience methods for creating RDFWriter objects. This method uses the registry returned by RDFWriterRegistry#getInstance() to get a factory for the specified format and uses this factory to create the appropriate writer.
[中]创建RDFWriter对象的便捷方法。此方法使用RDFWriterRegistry#getInstance()返回的注册表获取指定格式的工厂,并使用此工厂创建适当的编写器。

代码示例

代码示例来源:origin: org.wikibrainapi/wdtk-rdf

public RdfWriter(RDFFormat format, OutputStream output)
    throws UnsupportedRDFormatException {
  this.writer = Rio.createWriter(format, output);
}

代码示例来源:origin: org.apache.polygene.extensions/org.apache.polygene.extension.indexing-rdf

@Override
public void exportReadableToStream( PrintStream out )
  throws IOException
{
  RDFWriter rdfWriter = Rio.createWriter( RDFFormat.TRIG, out );
  exportToWriter( rdfWriter );
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public void exportFormalToWriter( PrintWriter out )
  throws IOException
{
  RDFWriter rdfWriter = Rio.createWriter( RDFFormat.RDFXML, out );
  exportToWriter( rdfWriter );
}

代码示例来源:origin: org.apache.polygene.extensions/org.apache.polygene.extension.indexing-rdf

@Override
public void exportFormalToWriter( PrintWriter out )
  throws IOException
{
  RDFWriter rdfWriter = Rio.createWriter( RDFFormat.RDFXML, out );
  exportToWriter( rdfWriter );
}

代码示例来源:origin: org.apache.marmotta/marmotta-sparql

@Override
  public void write(OutputStream outputStream) throws IOException,
      WebApplicationException {
    try {
      final RDFWriter writer = Rio.createWriter(format, outputStream);
      sparqlService.createServiceDescription(writer, request.getRequestURL().toString(), isUpdate);
    } catch (RDFHandlerException e) {
      log.warn("Could not send SpaqlServiceDescription", e);
      throw new NoLogWebApplicationException(e, Response.serverError().entity(e).build());
    }
  }
};

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

public static void exportRepoToN3(Repository rep, String filePath) throws RepositoryException, FileNotFoundException, RDFHandlerException{
  File repoFile = new File(filePath);
  FileOutputStream fosRepo = new FileOutputStream(repoFile);
  RDFWriter repoWriter = Rio.createWriter(RDFFormat.N3, fosRepo);
  rep.getConnection().export(repoWriter);
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

public static void exportRepoToN3(Repository rep, String filePath) throws RepositoryException, FileNotFoundException, RDFHandlerException{
  File repoFile = new File(filePath);
  FileOutputStream fosRepo = new FileOutputStream(repoFile);
  RDFWriter repoWriter = Rio.createWriter(RDFFormat.N3, fosRepo);
  rep.getConnection().export(repoWriter);
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

public static void exportRepoToN3(Repository rep, String filePath) throws RepositoryException, FileNotFoundException, RDFHandlerException{
  File repoFile = new File(filePath);
  FileOutputStream fosRepo = new FileOutputStream(repoFile);
  RDFWriter repoWriter = Rio.createWriter(RDFFormat.N3, fosRepo);
  rep.getConnection().export(repoWriter);
}

代码示例来源:origin: org.openrdf.elmo/elmo-repository

private static RDFWriter createWriter(RDFFormat format, OutputStream out) {
  if (format.equals(RDFFormat.RDFXML)) {
    return new RDFXMLPrettyWriter(out);
  }
  return Rio.createWriter(format, out);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame20

@Override
public void writeTo(OutputStream stream, Syntax syntax)
  throws IOException, ModelRuntimeException
{
  RDFWriter rdfWriter = Rio.createWriter(getRDFFormat(syntax), stream);
  writeTo(rdfWriter);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame20

/**
 * Writes the whole ModelSet to the Writer. Depending on the Syntax the
 * context URIs might or might not be serialized. TriX should be able to
 * serialize contexts.
 */
@Override
public void writeTo(Writer writer, Syntax syntax) throws IOException,
    ModelRuntimeException {
  RDFWriter rdfWriter = Rio.createWriter(RepositoryModel
      .getRDFFormat(syntax), writer);
  this.writeTo(rdfWriter);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

@Override
public void writeTo(OutputStream stream, Syntax syntax) throws
// interface allows it
    IOException, ModelRuntimeException {
  RDFWriter rdfWriter = Rio.createWriter(getRDFFormat(syntax), stream);
  writeTo(rdfWriter);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

/**
 * Writes the whole ModelSet to the Writer. Depending on the Syntax the
 * context URIs might or might not be serialized. TriX should be able to
 * serialize contexts.
 */
@Override
public void writeTo(Writer writer, Syntax syntax) throws IOException, ModelRuntimeException {
  RDFWriter rdfWriter = Rio.createWriter(getRDFFormat(syntax), writer);
  this.writeTo(rdfWriter);
}

代码示例来源:origin: org.openrdf.elmo/elmo-repository

private static RDFWriter createWriter(RDFFormat format, Writer writer) {
  if (format.equals(RDFFormat.RDFXML)) {
    return new RDFXMLPrettyWriter(writer);
  }
  return Rio.createWriter(format, writer);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

/**
 * Writes the whole ModelSet to the OutputStream. Depending on the Syntax
 * the context URIs might or might not be serialized. TriX should be able to
 * serialize contexts.
 */
@Override
public void writeTo(OutputStream out, Syntax syntax) throws IOException, ModelRuntimeException {
  RDFWriter rdfWriter = Rio.createWriter(getRDFFormat(syntax), out);
  this.writeTo(rdfWriter);
}

代码示例来源:origin: org.openrdf.elmo/elmo-repository

private SeRQOBuilder createBuilder(Writer writer) {
  SeRQOBuilder builder = new SeRQOBuilder();
  RDFWriter rdf = Rio.createWriter(format, writer);
  builder.setRDFHandler(rdf);
  return builder;
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame20

public void writeTo(Writer writer, Syntax syntax)
  throws ModelRuntimeException
{
  assertModel();
  RDFWriter rdfWriter = Rio.createWriter(getRDFFormat(syntax), writer);
  writeTo(rdfWriter);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

@Override
public void writeTo(Writer writer, Syntax syntax) throws ModelRuntimeException {
  assertModel();
  RDFWriter rdfWriter = Rio.createWriter(getRDFFormat(syntax), writer);
  writeTo(rdfWriter);
}

代码示例来源:origin: com.github.ansell.sesame-rio-extensions/sesame-rio-extensions-rdfjson

@Test
public void testWriterFactoryRegistered()
{
  final RDFFormat fmt = Rio.getWriterFormatForMIMEType("application/rdf+json");
  Assert.assertNotNull("Could not find the RDF/JSON RDFFormat instance", fmt);
  final RDFWriter writer = Rio.createWriter(fmt, new StringWriter());
  Assert.assertTrue(writer instanceof RDFJSONWriter);
}

代码示例来源:origin: com.github.ansell.sesame-rio-extensions/sesame-rio-extensions-rdfjson

@Test
  public void testWriterFactoryRegisteredAlternate()
  {
    final RDFFormat fmt = Rio.getWriterFormatForMIMEType("application/json");
    Assert.assertNotNull("Could not find the RDF/JSON RDFFormat instance", fmt);
    final RDFWriter writer = Rio.createWriter(fmt, new StringWriter());
    Assert.assertTrue(writer instanceof RDFJSONWriter);
  }
}

相关文章