Examples of TurtleWriter


Examples of org.apache.any23.writer.TurtleWriter

    public String getExampleOutput() throws IOException, ExtractionException {
        if (factory.getExampleInput() == null) {
            return null;
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        TripleHandler writer = new TurtleWriter(out);
        new SingleDocumentExtraction(
                new StringDocumentSource(getExampleInput(), getExampleURI()),
                factory,
                writer).run();
        try {
            writer.close();
        } catch (TripleHandlerException e) {
            throw new ExtractionException("Error while closing the triple handler", e);
        }
        return out.toString("utf-8");
    }
View Full Code Here

Examples of org.apache.any23.writer.TurtleWriter

    public String getExampleOutput() throws IOException, ExtractionException {
        if (factory.getExampleInput() == null) {
            return null;
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        TripleHandler writer = new TurtleWriter(out);
        new SingleDocumentExtraction(
                new StringDocumentSource(getExampleInput(), getExampleURI()),
                factory,
                writer).run();
        try {
            writer.close();
        } catch (TripleHandlerException e) {
            throw new ExtractionException("Error while closing the triple handler", e);
        }
        return out.toString("utf-8");
    }
View Full Code Here

Examples of org.openrdf.rio.turtle.TurtleWriter

   *
   * @param out
   *        The OutputStream to write the N3 document to.
   */
  public N3Writer(OutputStream out) {
    ttlWriter = new TurtleWriter(out);
  }
View Full Code Here

Examples of org.openrdf.rio.turtle.TurtleWriter

   *
   * @param writer
   *        The Writer to write the N3 document to.
   */
  public N3Writer(Writer writer) {
    ttlWriter = new TurtleWriter(writer);
  }
View Full Code Here

Examples of org.openrdf.rio.turtle.TurtleWriter

     * @throws RepositoryException
     */
    protected String dumpModelToTurtle() throws RepositoryException {
        StringWriter w = new StringWriter();
        try {
            conn.export(new TurtleWriter(w));
            return w.toString();
        } catch (RDFHandlerException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

Examples of org.openrdf.rio.turtle.TurtleWriter

    return true;
  }

  public void writeR2RMLMapping(PrintWriter writer)  {
    try {
      con.export(new TurtleWriter(writer));
    } catch (RepositoryException e) {
      logger.error("Error occured while outputing R2RML mapping");
    } catch (RDFHandlerException e) {
      logger.error("Error occured while outputing R2RML mapping");
    }
View Full Code Here

Examples of org.openrdf.rio.turtle.TurtleWriter

   *
   * @param out
   *        The OutputStream to write the N3 document to.
   */
  public N3Writer(OutputStream out) {
    ttlWriter = new TurtleWriter(out);
  }
View Full Code Here

Examples of org.openrdf.rio.turtle.TurtleWriter

   *
   * @param writer
   *        The Writer to write the N3 document to.
   */
  public N3Writer(Writer writer) {
    ttlWriter = new TurtleWriter(writer);
  }
View Full Code Here

Examples of org.openrdf.rio.turtle.TurtleWriter

    if (format == RDFFormat.NTRIPLES) {
      rdfDocumentWriter = new NTriplesWriter(stringWriter);
    } else if (format == RDFFormat.RDFXML) {
      rdfDocumentWriter = new RdfXmlWriter(stringWriter);
    } else {
      rdfDocumentWriter = new TurtleWriter(stringWriter);
    }
   
    try {
      for (Namespace namespace : Namespace.values()) {
        rdfDocumentWriter.setNamespace(namespace.getName(), namespace.getURI());
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.