Examples of RDFWriter


Examples of org.openrdf.rio.RDFWriter

  @Override
  public void write(OutputStream out)
    throws IOException
  {
    try {
      RDFWriter rdfWriter = rdfWriterFactory.getWriter(out);
      QueryResultUtil.report(graphResult, rdfWriter);
    }
    catch (StoreException e) {
      logger.error("Query evaluation error", e);
      throw new IOException("Query evaluation error: " + e.getMessage());
View Full Code Here

Examples of org.openrdf.rio.RDFWriter

  @Override
  public void write(OutputStream out)
    throws IOException
  {
    try {
      RDFWriter rdfWriter = rdfWriterFactory.getWriter(out);
      // rdfWriter.setBaseURI(requestURL);

      rdfWriter.startRDF();

      for (Map.Entry<String, String> ns : model.getNamespaces().entrySet()) {
        rdfWriter.handleNamespace(ns.getKey(), ns.getValue());
      }

      for (Statement st : model) {
        rdfWriter.handleStatement(st);
      }

      rdfWriter.endRDF();
    }
    catch (RDFHandlerException e) {
      logger.error("Serialization error", e);
      throw new IOException("Serialization error: " + e.getMessage());
    }
View Full Code Here

Examples of org.openrdf.rio.RDFWriter

   * 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);
  }
View Full Code Here

Examples of org.openrdf.rio.RDFWriter

   * 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);
  }
View Full Code Here

Examples of org.openrdf.rio.RDFWriter

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

Examples of org.openrdf.rio.RDFWriter

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

Examples of org.openrdf.rio.RDFWriter

            Vocabulary vocabulary,
            VocabularyFormat format,
            boolean willFollowAnother,
            PrintStream ps
    ) throws RDFHandlerException {
        final RDFWriter rdfWriter;
        if(format == VocabularyFormat.RDFXML) {
            rdfWriter = new RDFXMLWriter(ps);
            if(willFollowAnother)
                ps.print("\n");
                ps.print(RDF_XML_SEPARATOR);
View Full Code Here

Examples of org.openrdf.rio.RDFWriter

  }

  protected static void saveRDF(List<Statement> stmts, String filename) {
    try {
      File file = new File(filename);
      RDFWriter writer = Rio.createWriter(RDFFormat.TURTLE, new FileWriter(file));


      writer.startRDF();
      for (Statement stmt : stmts) {
        writer.handleStatement(stmt);
      }
      writer.endRDF();

    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of org.openrdf.rio.RDFWriter

    }
   
    FileWriter writer;
    try {
      writer = new FileWriter(targetFile);
      RDFWriter rdfWriter = Rio.createWriter(format, writer);
      conn.export(rdfWriter);
      conn.close();
    } catch (Exception e) {
      Global.log().warning("Failed to write the end results");
    }    
View Full Code Here

Examples of org.openrdf.rio.RDFWriter

    }
  }
  public void writeResult(File output) {
    try {
      FileWriter writer = new FileWriter(output);
      RDFWriter rdfWriter = Rio.createWriter(rdfType, writer);
      conn.export(rdfWriter);
      conn.close();
   
    } catch (RepositoryException e) {
      Global.log().warning("Failed to write annotated output RDF");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.