org.apache.jena.query.Query.serialize()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.apache.jena.query.Query.serialize方法的一些代码示例,展示了Query.serialize的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.serialize方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:serialize

Query.serialize介绍

[英]Convert the query to a string
[中]将查询转换为字符串

代码示例

代码示例来源:origin: apache/jena

/** Format the query
 * 
 * @param buff       IndentedLineBuffer in which to place the unparsed query
 * @param outSyntax  Syntax URI
 */

public void serialize(IndentedLineBuffer buff, Syntax outSyntax) { 
  serialize((IndentedWriter)buff, outSyntax);
}

代码示例来源:origin: apache/jena

/** Format the query
 * 
 * @param writer  IndentedWriter
 */

public void serialize(IndentedWriter writer) { 
  serialize(writer, syntax); 
}

代码示例来源:origin: apache/jena

@Override
public void output(IndentedWriter out)
{
  serialize(out) ;
}

代码示例来源:origin: apache/jena

/** Format the query into the buffer
 * 
 * @param buff    IndentedLineBuffer
 */

public void serialize(IndentedLineBuffer buff) { 
  serialize(buff, syntax); 
}

代码示例来源:origin: apache/jena

/** Output the query
 * @param out  OutputStream
 */
public void serialize(OutputStream out) { serialize(out, syntax); }

代码示例来源:origin: apache/jena

private static void outputSyntax(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
{
  output(outStream, (out)->query.serialize(out), lineNumbers) ;
}

代码示例来源:origin: apache/jena

public static void printQuery(IndentedWriter out, Query query, Syntax syntax)
{
  query.serialize(out, syntax) ;
  out.flush() ;
}

代码示例来源:origin: org.apache.jena/jena-fuseki-core

private static void outputSyntax(ServletOutputStream outStream, final Query query, boolean lineNumbers) throws IOException
{
  output(outStream, (out)->query.serialize(out), lineNumbers) ;
}

代码示例来源:origin: apache/jena

/** Output the query
 * 
 * @param out     OutputStream
 * @param syntax  Syntax URI
 */

public void serialize(OutputStream out, Syntax syntax) { 
  IndentedWriter writer = new IndentedWriter(out) ;
  serialize(writer, syntax) ;
  writer.flush() ;
  try { out.flush() ; } catch (Exception ex) { } 
}

代码示例来源:origin: apache/jena

/** Convert the query to a string in the given syntax
 * @param syntax
 */

public String serialize(Syntax syntax)
{
  IndentedLineBuffer buff = new IndentedLineBuffer() ;
  serialize(buff, syntax) ;
  return buff.toString();
}

代码示例来源:origin: apache/jena

/** Convert the query to a string */

public String serialize()
{
  IndentedLineBuffer buff = new IndentedLineBuffer() ;
  serialize(buff) ;
  return buff.toString();
}

代码示例来源:origin: apache/jena

private String formatForLog(Query query) {
  IndentedLineBuffer out = new IndentedLineBuffer() ;
  out.setFlatMode(true) ;
  query.serialize(out) ;
  return out.asString() ;
}

代码示例来源:origin: org.apache.jena/jena-fuseki-core

private String formatForLog(Query query) {
  IndentedLineBuffer out = new IndentedLineBuffer() ;
  out.setFlatMode(true) ;
  query.serialize(out) ;
  return out.asString() ;
}

代码示例来源:origin: stackoverflow.com

public static String replacePrefixes(String query, PrefixMapping pmap){
  /* With Prologue and the parse method, 
   * the queryString gets parsed without an error
   */
  Prologue prog = new Prologue();
  prog.setPrefixMapping(pmap);
  Query q = QueryFactory.parse(new Query(prog), query, null, null);
  //Set Prefix Mapping
  q.setPrefixMapping(pmap);
  //remove PrefixMapping so the prefixes will get replaced by the full uris
  q.setPrefixMapping(null);       
  return q.serialize();
}

代码示例来源:origin: apache/jena

private static void formatted(JsonBuilder obj, Query query) {
  IndentedLineBuffer out = new IndentedLineBuffer() ;
  query.serialize(out) ;
  obj.key(jFormatted).value(out.asString()) ;
}

代码示例来源:origin: org.apache.jena/jena-fuseki-core

private static void formatted(JsonBuilder obj, Query query) {
  IndentedLineBuffer out = new IndentedLineBuffer() ;
  query.serialize(out) ;
  obj.key(jFormatted).value(out.asString()) ;
}

代码示例来源:origin: apache/jena

public static void explain(String message, Query query, Context context) {
  if ( explaining(InfoLevel.INFO, logExec, context) ) {
    // One line or indented multiline format
    IndentedLineBuffer iBuff = new IndentedLineBuffer() ;
    if ( true )
      iBuff.incIndent() ;
    else
      iBuff.setFlatMode(true) ;
    query.serialize(iBuff) ;
    String x = iBuff.asString() ;
    _explain(logExec, message, x, true) ;
  }
}

代码示例来源:origin: apache/jena

@Test public void customAgg_10() {
  String qs = "SELECT (AGG <"+aggIRI+">(?o) AS ?x) {?s ?p ?o } GROUP BY ?s" ;
  Query q = QueryFactory.create(qs, Syntax.syntaxARQ) ;
  String qs2 = q.serialize(Syntax.syntaxARQ) ;
  Query q2 = QueryFactory.create(qs2, Syntax.syntaxARQ) ;
  assertEquals(q, q2) ;
}

代码示例来源:origin: apache/jena

@Test public void customAgg_11() {
  String qs = "SELECT (<"+aggIRI+">(?o) AS ?x) {?s ?p ?o } GROUP BY ?s" ;
  Query q = QueryFactory.create(qs) ;
  String qs2 = q.serialize() ;
  Query q2 = QueryFactory.create(qs2) ;
  assertEquals(q, q2) ;
}

代码示例来源:origin: apache/jena

@Test public void customAgg_12() {
  LogCtl.setError(AggregatorFactory.class);
  try {
    String qs = "SELECT (AGG <"+aggIRI2+">(?o) AS ?x) {?s ?p ?o } GROUP BY ?s" ;
    Query q = QueryFactory.create(qs, Syntax.syntaxARQ) ;
    String qs2 = q.serialize(Syntax.syntaxARQ) ;
    Query q2 = QueryFactory.create(qs2, Syntax.syntaxARQ) ;
    assertEquals(q, q2) ;
  } finally {
    LogCtl.setInfo(AggregatorFactory.class);
  }
}

相关文章