Package org.openrdf.rio

Examples of org.openrdf.rio.RdfDocumentWriter


   * @param format
   * @return
   */
  public static String extractRDF(LocalRepository repository, RDFFormat format) {
    StringWriter stringWriter = new StringWriter();
    RdfDocumentWriter rdfDocumentWriter;
    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());
      }
     
      repository.extractRDF(rdfDocumentWriter, true, true, true, true);
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.openrdf.rio.RdfDocumentWriter

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.