private boolean xsdStringToPlainLiteral() { return getWriterConfig().get(BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL); } }
@Override public <T> RDFWriter set(RioSetting<T> setting, T value) { getWriterConfig().set(setting, value); return this; } }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { this.testWriter = new StringWriter(); this.testWriterConfig = new WriterConfig(); this.testWriterConfig.set(BasicWriterSettings.PRETTY_PRINT, false); }
public SPARQLResultsHTMLWriter(OutputStream out) { this.out = out; this.config = new WriterConfig(); }
public void endDocument() throws IOException { jg.writeEndObject(); if (getWriterConfig().isSet(BasicQueryWriterSettings.JSONP_CALLBACK)) { jg.writeRaw(");"); } jg.flush(); documentOpen = false; headerOpen = false; headerComplete = false; tupleVariablesFound = false; firstTupleWritten = false; linksFound = false; }
public SPARQLResultsHTMLWriter(OutputStream out) { this.out = out; this.config = new WriterConfig(); }
public void endDocument() throws IOException { jg.writeEndObject(); if (getWriterConfig().isSet(BasicQueryWriterSettings.JSONP_CALLBACK)) { jg.writeRaw(");"); } jg.flush(); documentOpen = false; headerOpen = false; headerComplete = false; tupleVariablesFound = false; firstTupleWritten = false; linksFound = false; }
@Override public void startRDF() throws RDFHandlerException { this.rootTypes = getWriterConfig().get(JSONLD.ROOT_TYPES); }
/** * Test specifically for JSONP callback support. */ protected void doTupleJSONPCallback(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected) throws QueryResultHandlerException, QueryEvaluationException, QueryResultParseException, UnsupportedQueryResultFormatException, IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); // only do this test if the callback is enabled if (writer.getSupportedSettings().contains(BasicQueryWriterSettings.JSONP_CALLBACK)) { String callback = "nextfunctionname" + Math.abs(new Random().nextInt()); writer.getWriterConfig().set(BasicQueryWriterSettings.JSONP_CALLBACK, callback); QueryResults.report(input, writer); String result = out.toString("UTF-8"); // System.out.println("output: " + result); assertTrue(result.startsWith(callback + "(")); assertTrue(result.endsWith(");")); // Strip off the callback function and verify that it contains a valid // JSON object containing the correct results result = result.substring(callback.length() + 1, result.length() - 2); ByteArrayInputStream in = new ByteArrayInputStream(result.getBytes("UTF-8")); TupleQueryResult output = QueryResultIO.parseTuple(in, format); assertQueryResultsEqual(expected, output); } }
WriterConfig writerConfig = new WriterConfig(); writerConfig.set(JSONLDSettings.JSONLD_MODE, JSONLDMode.COMPACT); writerConfig.set(JSONLDSettings.OPTIMIZE, Boolean.TRUE); writerConfig.set(JSONLDSettings.USE_NATIVE_TYPES, Boolean.TRUE); writerConfig.set(BasicWriterSettings.PRETTY_PRINT, Boolean.valueOf(this.isWritePretty()));
public TurtlePrettyPrinter(URI base, Writer writer) { Objects.requireNonNull(writer, "Writer cannot be null"); this.base = base; this.out = new PrintWriter(writer); this.logPrefix = String.format("[%d] ",id); this.writerConfig=new WriterConfig(); }
protected void endDocument() throws IOException { jg.writeEndObject(); if (getWriterConfig().isSet(BasicQueryWriterSettings.JSONP_CALLBACK)) { jg.writeRaw(");"); } jg.flush(); documentOpen = false; headerOpen = false; headerComplete = false; tupleVariablesFound = false; firstTupleWritten = false; linksFound = false; }
@Override public void endRDF() throws RDFHandlerException { GraphRenderer renderer=new GraphRenderer(graph,writerConfig.get(ENABLE_FOLDING)); out.append(renderer.render()); out.flush(); trace("Completed RDF processing."); }
qrWriter.getWriterConfig().set(BasicQueryWriterSettings.JSONP_CALLBACK, parameter);
WriterConfig writerConfig = new WriterConfig(); writerConfig.set(BasicWriterSettings.PRETTY_PRINT, Boolean.valueOf(this.isWritePretty()));
/** * Writes the given statement to the given {@link OutputStream} in the given * format. * <p> * * @param st * The statement to be written. * @param output * The {@link OutputStream} to write the statement to. * @param dataFormat * The {@link RDFFormat} to use when writing the statement. * @throws RDFHandlerException * Thrown if there is an error writing the statement. * @throws UnsupportedRDFormatException * If no {@link RDFWriter} is available for the specified RDF format. * @since 2.8.0 */ public static void write(Statement st, OutputStream output, RDFFormat dataFormat) throws RDFHandlerException { write(st, output, dataFormat, new WriterConfig()); }
@Override public void startQueryResult(List<String> vars) throws TupleQueryResultHandlerException { if(templatingService == null) { templatingService = getWriterConfig().get(SPARQLHTMLSettings.TEMPLATING_SERVICE); if(templatingService == null) { throw new IllegalStateException("Templating service was not setup"); } } Map<String, Object> data = new HashMap<>(); data.put("vars", vars); this.vars = vars; try { templatingService.process(SPARQLResultsHTMLWriter.class, START_TEMPLATE, data, new OutputStreamWriter(out)); } catch (Exception e) { log.error(e.getMessage(), e); throw new TupleQueryResultHandlerException(e); } }