Package org.openrdf.rio

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


   * 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

 
  @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

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

            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

  }

  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

    }
   
    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

    }
  }
  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

        }
      }
    }
   
    File file = new File(root, PROV_FILE);
    RDFWriter writer = Rio.createWriter(RDFFormat.TURTLE, new FileWriter(file));
   
    try {
      writer.startRDF();
      for (Statement stmt : stmts) {
        writer.handleStatement(stmt);
      }
      writer.endRDF();
     
    } catch (RDFHandlerException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

        try {
            this.commit();
            final SailConnection c = this.rawGraph.getConnection();
            try {
                c.begin();
                RDFWriter w = Rio.createWriter(getFormat(format), output);
                w.startRDF();

                CloseableIteration<? extends Statement, SailException> iter = c.getStatements(null, null, null, false);
                try {
                    while (iter.hasNext()) {
                        w.handleStatement(iter.next());
                    }
                } finally {
                    iter.close();
                }

                w.endRDF();
            } finally {
                c.rollback();
                c.close();
            }
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.openrdf.rio.RDFWriter

Copyright © 2018 www.massapicom. 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.