Examples of RDFHandler


Examples of org.openrdf.rio.RDFHandler

    // convenience methods, may be moved ///////////////////////////////////////

    public void dump(final OutputStream out) throws RepositoryException, RDFHandlerException {
        RDFFormat format = RDFFormat.TRIG;
        LOGGER.info("dumping triple store in format " + format.getName() + " to output stream");
        RDFHandler h = Rio.createWriter(format, out);
        RepositoryConnection rc = getRepository().getConnection();
        try {
            rc.begin();
            rc.export(h);
        } finally {
View Full Code Here

Examples of org.openrdf.rio.RDFHandler

    public void dumpToFile(final File file,
                           final RDFFormat format) throws IOException, RepositoryException, RDFHandlerException {
        LOGGER.info("dumping triple store in format " + format.getName() + " to file: " + file);
        OutputStream out = new FileOutputStream(file);
        try {
            RDFHandler h = Rio.createWriter(format, out);
            RepositoryConnection rc = getRepository().getConnection();
            try {
                rc.export(h);
            } finally {
                rc.close();
View Full Code Here

Examples of org.openrdf.rio.RDFHandler

        LOGGER.info("dumping compressed triple store in format " + format.getName() + " to file: " + file);
        OutputStream out = new FileOutputStream(file);
        try {
            OutputStream gzipOut = new GZIPOutputStream(out);
            try {
                RDFHandler h = Rio.createWriter(format, gzipOut);
                RepositoryConnection rc = getRepository().getConnection();
                try {
                    rc.export(h);
                } finally {
                    rc.close();
View Full Code Here

Examples of org.openrdf.rio.RDFHandler

            RepositoryConnection con = response.getTriples().getConnection();
            con.begin();

            ByteArrayOutputStream out = new ByteArrayOutputStream();
            RDFHandler handler = new RDFXMLPrettyWriter(out);
            con.export(handler);

            con.commit();
            con.close();
View Full Code Here

Examples of org.openrdf.rio.RDFHandler

            RDFBuffer buffer = new RDFBuffer(adder);

            // Note: any context information in the source document is discarded.
            RDFSink pipe = new SingleContextPipe(buffer, valueFactory.createURI(graphUri), valueFactory);

            RDFHandler handler = new SesameInputAdapter(useBlankNodes
                    ? pipe
                    : new BNodeToURIFilter(pipe, valueFactory));

            InputStream is;
            try {
View Full Code Here

Examples of org.openrdf.rio.RDFHandler

                sail.shutDown();
            }

            RepositoryConnection rc = repo.getConnection();
            try {
                rc.export(new RDFHandler() {
                    public void startRDF() throws RDFHandlerException {
                    }

                    public void endRDF() throws RDFHandlerException {
                    }
View Full Code Here

Examples of org.openrdf.rio.RDFHandler

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

Examples of org.openrdf.rio.RDFHandler

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

Examples of org.openrdf.rio.RDFHandler

    client.deleteConcept(testTopic);
  }

  private void writeModel(Model model, RDFFormat format, OutputStream out) throws RDFHandlerException {

    final RDFHandler writer = new BufferedGroupingRDFHandler(Rio.createWriter(format, out));
    writer.startRDF();
    writer.handleNamespace("rdf", RDF.NAMESPACE);
    writer.handleNamespace("rdfs", RDFS.NAMESPACE);
    writer.handleNamespace("skos", SKOS.NAMESPACE);
    writer.handleNamespace("dc", DC.NAMESPACE);
    writer.handleNamespace("primal", PRIMAL.NAMESPACE);

    for (final Statement st : model) {
      writer.handleStatement(st);
    }
    writer.endRDF();
  }
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.