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

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

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

Query.isJsonType介绍

暂无

代码示例

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

@Override
public void visitJsonResultForm(Query query) {
  check("Not both JSON queries", query2.isJsonType()) ;
}

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

static private String labelForQuery(Query q) {
  if ( q.isSelectType() )     return "SELECT" ; 
  if ( q.isConstructType() )  return "CONSTRUCT" ; 
  if ( q.isDescribeType() )   return "DESCRIBE" ; 
  if ( q.isAskType() )        return "ASK" ;
  if ( q.isJsonType() )       return "JSON" ;
  return "<<unknown>>" ;
}

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

@Override
public Iterator<JsonObject> execJsonItems() 
{
  checkNotClosed() ;
  if ( ! query.isJsonType() )
    throw new QueryExecException("Attempt to get a JSON result from a " + labelForQuery(query)+" query") ;
  startQueryIterator() ;
  return new JsonIterator(queryIterator, query.getResultVars()) ;
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

String str = ResultSetFormatter.asText(rs);
  System.err.println(str);
} else if(q.isJsonType()) {
  String json = qe.execJson().toString();
  System.out.println(json);

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

if ( query.isJsonType() )

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

if ( query.isJsonType() )

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

@Override
public JsonArray execJson()
{
  checkNotClosed() ;
  if ( ! query.isJsonType() )
    throw new QueryExecException("Attempt to get a JSON result from a " + labelForQuery(query)+" query") ;
  startQueryIterator() ;
  JsonArray jsonArray = new JsonArray() ;
  List<String> resultVars = query.getResultVars() ;
  while (queryIterator.hasNext())
  {
    Binding binding = queryIterator.next() ;
    JsonObject jsonObject = new JsonObject() ; 
    for (String resultVar : resultVars) {
      Node n = binding.get(Var.alloc(resultVar)) ;
      JsonValue value = RDFTerm2Json.fromNode(n) ;
      jsonObject.put(resultVar, value) ;
    }
    jsonArray.add(jsonObject) ;
  }
  return jsonArray ;
}

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

public static void executeQuery(Prologue prologue, QueryExecution queryExecution, ResultsFormat outputFormat) {
  Query query = queryExecution.getQuery() ;
  if ( prologue == null )
    prologue = query.getPrologue() ;
  if ( prologue == null )
    prologue = dftPrologue ;
  if ( query.isSelectType() )
    doSelectQuery(prologue, queryExecution, outputFormat) ;
  else if ( query.isDescribeType() )
    doDescribeQuery(prologue, queryExecution, outputFormat) ;
  else if ( query.isConstructQuad() )
    // Before isConstructType.
    doConstructQuadsQuery(prologue, queryExecution, outputFormat) ;
  else if ( query.isConstructType() )
    doConstructQuery(prologue, queryExecution, outputFormat) ;
  else if ( query.isAskType() )
    doAskQuery(prologue, queryExecution, outputFormat) ;
  else if ( query.isJsonType() )
    doJsonQuery(prologue, queryExecution, outputFormat) ;
  else
    throw new QueryException("Unrecognized query form");
}

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

else if ( query.isAskType() )
  runTestAsk(query, qe) ;
else if ( query.isJsonType() )
  throw new UnsupportedOperationException("JSON {} queries not supported");

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

ResultSet rs = qe.execSelect();
  result = new SPARQLResultEx(rs);
} else if(q.isJsonType()) {
  Iterator<JsonObject> it = qe.execJsonItems();
  result = new SPARQLResultEx(it);

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

public void visit(QueryVisitor visitor)
{
  visitor.startVisit(this) ;
  visitor.visitResultForm(this) ;
  visitor.visitPrologue(this) ;
  if ( this.isSelectType() )
    visitor.visitSelectResultForm(this) ;
  if ( this.isConstructType() )
    visitor.visitConstructResultForm(this) ;
  if ( this.isDescribeType() )
    visitor.visitDescribeResultForm(this) ;
  if ( this.isAskType() )
    visitor.visitAskResultForm(this) ;
  if ( this.isJsonType() )
    visitor.visitJsonResultForm(this) ;
  visitor.visitDatasetDecl(this) ;
  visitor.visitQueryPattern(this) ;
  visitor.visitGroupBy(this) ;
  visitor.visitHaving(this) ;
  visitor.visitOrderBy(this) ;
  visitor.visitOffset(this) ;
  visitor.visitLimit(this) ;
  visitor.visitValues(this) ;
  visitor.finishVisit(this) ;
}

相关文章