Package org.openrdf.rio

Examples of org.openrdf.rio.RDFWriter


    setContentType(response, rdfFormat);
    setContentDisposition(model, response, rdfFormat);

    OutputStream out = response.getOutputStream();
    try {
      RDFWriter rdfWriter = rdfWriterFactory.getWriter(out);
      GraphQueryResult graphQueryResult = (GraphQueryResult)model.get(QUERY_RESULT_KEY);
      QueryResultUtil.report(graphQueryResult, rdfWriter);
    }
    catch (QueryEvaluationException e) {
      logger.error("Query evaluation error", e);
View Full Code Here


    con1.add(ciaScheme, ciaScheme.toExternalForm(), RDFFormat.forFileName(ciaScheme.toExternalForm()));
    con1.add(ciaFacts, ciaFacts.toExternalForm(), RDFFormat.forFileName(ciaFacts.toExternalForm()));

    StringWriter writer = new StringWriter();
    RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer);
    con1.export(rdfWriter);

    con1.close();

    Repository rep2 = new SailRepository(new MemoryStore());
View Full Code Here

    String tmpDir = System.getProperty("java.io.tmpdir");
    File tmpFile = new File(tmpDir, "junit-" + name + ".nt");

    OutputStream export = new FileOutputStream(tmpFile);
    try {
      RDFWriter writer = Rio.createWriter(RDFFormat.NTRIPLES, export);

      writer.startRDF();
      for (Statement st : statements) {
        writer.handleStatement(st);
      }
      writer.endRDF();
    }
    finally {
      export.close();
    }
View Full Code Here

            Vocabulary vocabulary,
            RDFFormat format,
            boolean willFollowAnother,
            PrintStream ps
    ) throws RDFHandlerException {
        final RDFWriter rdfWriter;
        if(format == RDFFormat.RDFXML) {
            rdfWriter = Rio.createWriter(RDFFormat.RDFXML, ps);
            if(willFollowAnother)
                ps.print("\n");
                ps.print(RDF_XML_SEPARATOR);
View Full Code Here

      }
        Repository model = buildModel(project, engine, schema);
        try{
          RepositoryConnection con = model.getConnection();
          try{
            RDFWriter writer = Rio.createWriter(format, outputStream);
            for(Vocabulary v:schema.getPrefixesMap().values()){
              writer.handleNamespace(v.getName(), v.getUri());
            }
            con.export(writer);
      }finally{
            con.close();
          }
View Full Code Here

      }
        Repository model = buildModel(project, engine, schema);
        try{
          RepositoryConnection con = model.getConnection();
          try{
            RDFWriter w = Rio.createWriter(format, writer);
            for(Vocabulary v:schema.getPrefixesMap().values()){
              w.handleNamespace(v.getName(),v.getUri());
            }
            con.export(w);
      }finally{
            con.close();
          }
View Full Code Here

                //create response serialisation
                StreamingOutput entity = new StreamingOutput() {
                    @Override
                    public void write(OutputStream output) throws IOException, WebApplicationException {
                        RDFWriter writer = Rio.createWriter(serializer, output);
                        try {
                            RepositoryConnection con = versioningService.getSnapshot(date);
                            URI subject = con.getValueFactory().createURI(resource.stringValue());
                            try {
                                con.exportStatements(subject,null,null,true,writer);
View Full Code Here

                    StreamingOutput entity = new StreamingOutput() {
                        @Override
                        public void write(OutputStream output) throws IOException, WebApplicationException {
                            // FIXME: This method is executed AFTER the @Transactional!
                            RDFWriter writer = Rio.createWriter(serializer,output);
                            try {
                                RepositoryConnection connection = sesameService.getConnection();
                                try {
                                    connection.begin();
                                    connection.exportStatements(subject,null,null,true,writer);
View Full Code Here

        final StreamingOutput entity = new StreamingOutput() {
            @Override
            public void write(OutputStream outputStream) throws IOException,
                    WebApplicationException {
                try {
                    final RDFWriter writer = Rio.createWriter(format, outputStream);
                    sparqlService.createServiceDescription(writer, request.getRequestURL().toString(), isUpdate);
                } catch (RDFHandlerException e) {
                    log.warn("Could not send SpaqlServiceDescription: {}", e);
                    throw new NoLogWebApplicationException(e, Response.serverError().entity(e).build());
                }
View Full Code Here

            log.warn("could not find serializer for MIME type {}",mimeType);
            throw new UnsupportedExporterException("No serializer for mime type "+mimeType);
        }

        // HINT: This method might be executed outside a transaction!
        RDFWriter handler = Rio.createWriter(serializer,writer);
        try {
            RepositoryConnection connection = sesameService.getConnection();
            connection.begin();
            try {
                if(context == null) {
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.