@Override public void close() { rdfWriter.endRDF(); } }
@Override public void close() throws IOException { this.writer.endRDF(); }
public void finish() throws RDFHandlerException { this.writer.endRDF(); }
@Override public void close() throws TripleHandlerException { if (closed) return; closed = true; try { writer.endRDF(); } catch (RDFHandlerException e) { throw new TripleHandlerException("Error while closing the triple handler.", e); } }
@Override protected void cleanup(Context context) throws IOException, InterruptedException { writer.endRDF(); out.close(); sail.close(); } }
@Override protected void cleanup(Context context) throws IOException, InterruptedException { if (writer == null) { sail.commit(); sail.close(); } else { writer.endRDF(); out.close(); } } }
public void endRDF() throws RDFHandlerException { trimNamespaces(); flushStatements(); delegate.endRDF(); }
@Override public void endRDF() throws RDFHandlerException { trimNamespaces(); flushStatements(); delegate.endRDF(); }
@Override public byte[] serialize(final String topic, final Set<Statement> data) { if(data == null) { // Returning null because that is the contract of this method. return null; } // Write the statements using a Binary RDF Writer. final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final RDFWriter writer = WRITER_FACTORY.getWriter(baos); writer.startRDF(); for(final Statement stmt : data) { // Write the statement. log.debug("Writing Statement: " + stmt); writer.handleStatement(stmt); } writer.endRDF(); // Return the byte[] version of the data. return baos.toByteArray(); }
@Override protected void map(Text key, RyaStatementWritable value, Context context) throws IOException, InterruptedException { // receives a RyaStatementWritable; convert to a Statement RyaStatement rstmt = value.getRyaStatement(); Statement st = RyaToRdfConversions.convertStatement(rstmt); logger.info("Mapper receives: " + rstmt); // then convert to an RDF string StringWriter writer = new StringWriter(); try { RDFWriter rdfWriter = Rio.createWriter(rdfFormat, writer); rdfWriter.startRDF(); rdfWriter.handleStatement(st); rdfWriter.endRDF(); } catch (RDFHandlerException e) { throw new IOException("Error writing RDF data", e); } // Write the string to the output String line = writer.toString().trim(); logger.info("Serialized to RDF: " + line); textOut.set(line); context.write(NullWritable.get(), textOut); } }
@Override public void write(OutputStream outputStream) throws IOException, WebApplicationException { RDFWriter writer = Rio.createWriter(getFormat(acceptHeaderParam), outputStream); SimpleValueFactory valueFactory = SimpleValueFactory.getInstance(); handleNamespaces(writer, gds); writer.startRDF(); try (Transaction tx = gds.beginTx()) { Map<String, String> mappings = getMappingsFromDB(gds); Node node = (Node) gds.getNodeById(idParam); processNodeInLPG(writer, valueFactory, mappings, node, onlyMappedInfo!=null); if (excludeContextParam == null) { processRelsOnLPG(writer, valueFactory, mappings, node, onlyMappedInfo!=null); } writer.endRDF(); }catch(NotFoundException e){ writer.endRDF(); } }
@Override public void execute(SesamizeArgs args) throws Exception { Long totalTriples = Long.valueOf(args.nonOptions.get(1)); RDFFormat outputFormat = args.getRDFFormat(RDFFormat.RDFXML, "o", "outputFormat"); OutputStream os = System.out; RandomValueFactory rvf = new RandomValueFactory( SimpleValueFactory.getInstance()); RDFWriter writer = Rio.createWriter(outputFormat, os); writer.startRDF(); for (long l = 0L; l < totalTriples; l++) { Statement st = rvf.randomStatement(); writer.handleStatement(st); } writer.endRDF(); os.close(); } }
writer.endRDF(); result.close();
@Override public void writeGraphQueryResult(GraphQueryResult queryResult) throws ExportException { try { writer.startRDF(); for (Map.Entry<String, String> me : queryResult.getNamespaces().entrySet()) { writer.handleNamespace(me.getKey(), me.getValue()); } while (queryResult.hasNext()) { writer.handleStatement(queryResult.next()); tick(); } writer.endRDF(); } catch (QueryEvaluationException | RDFHandlerException e) { throw new ExportException(e); } }
if (splitOutput || out == null) { if (out != null) { writer.endRDF(); out.close();
writer.endRDF(); result.close();
@Override public void write(final OutputStream os) throws IOException { try { RDFWriter writer = Rio.createWriter(format, os); writer.startRDF(); try { for (Namespace ns : namespaces) { writer.handleNamespace(ns.getPrefix(), ns.getName()); } for (Statement st : statements) { writer.handleStatement(st); } writer.handleComment("created by LinkedDataServer " + SesameTools.getProperties().getProperty(SesameTools.VERSION_PROP) + " using the Sesame 2 RDF framework"); } finally { writer.endRDF(); } } catch (Throwable t) { if (t instanceof IOException) { throw (IOException) t; } else { logger.log(Level.WARNING, "failed to write RDF representation", t); throw new IOException(t.getMessage()); } } } }
writer.endRDF(); result.close(); }catch (Exception e){
writer.handleStatement( RDFUtils.quad(property, RDFS.COMMENT, RDFUtils.literal(comment), namespace) ); writer.endRDF();