Package org.openrdf.rio.ntriples

Examples of org.openrdf.rio.ntriples.NTriplesWriter


            if(willFollowAnother)
                ps.print("\n");
                ps.print(RDF_XML_SEPARATOR);
                ps.print("\n");
        } else if(format == VocabularyFormat.NTriples) {
            rdfWriter = new NTriplesWriter(ps);
        } else if(format == VocabularyFormat.NQuads) {
            rdfWriter = new NQuadsWriter(ps);
        }
        else {
            throw new IllegalArgumentException("Unsupported format " + format);
View Full Code Here


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

      // test export and handlers
      File f = new File("results.n3.txt");
      try {
        ok = true;
        log("Writing the statements to file: (" + f.getAbsolutePath() + ")");
        RDFHandler ntw = new NTriplesWriter(new FileOutputStream(f));
        con.exportStatements(kingsleyidehen, name, null, false, ntw);
      }
      catch (Exception e) {
        log("Error[" + e + "]");
        e.printStackTrace();
View Full Code Here

      // test export and handlers
      File f = new File("results.n3.txt");
      try {
        ok = true;
        log("Writing the statements to file: (" + f.getAbsolutePath() + ")");
        RDFHandler ntw = new NTriplesWriter(new FileOutputStream(f));
        con.exportStatements(kingsleyidehen, name, null, false, ntw);
      }
      catch (Exception e) {
        log("Error[" + e + "]");
        e.printStackTrace();
View Full Code Here

      Iterator<Statement> iter = mdGraph.iterator();
      Integer _stmtcnt = 0;
      String mdFile = String.format("%s.md.nt", inFile);

      FileOutputStream outStream = new FileOutputStream(mdFile);
      NTriplesWriter ntw = new NTriplesWriter (outStream);

      ntw.handleNamespace ("dc", dcNS);

      try {
    ntw.startRDF();
    while (iter.hasNext()) {
        Statement _stmt = iter.next();
        ntw.handleStatement(_stmt);
        _stmtcnt++;
    }
    ntw.endRDF();
    outStream.close();
      }
      catch (Exception e) {
    e.printStackTrace();
    System.exit (-1);
View Full Code Here

TOP

Related Classes of org.openrdf.rio.ntriples.NTriplesWriter

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.