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

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

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

Query.isConstructQuad介绍

暂无

代码示例

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

private static void doConstructQuery(Prologue prologue, QueryExecution qe, ResultsFormat outputFormat) {
  if ( qe.getQuery().isConstructQuad() ) {
    doConstructQuadsQuery(prologue, qe, outputFormat);
    return;
  }
  if ( outputFormat == null || outputFormat == ResultsFormat.FMT_UNKNOWN )
    outputFormat = ResultsFormat.FMT_RDF_TTL ;
  Model r = qe.execConstruct() ;
  writeModel(prologue, r, outputFormat) ;
}

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

void runTestConstruct(Query query, QueryExecution qe)
{
  // Do the query!
  if ( query.isConstructQuad() ){
    Dataset resultActual = qe.execConstructDataset();
    compareDatasetResults(resultActual, query) ;
  } else {
    Model resultsActual = qe.execConstruct() ;
    compareGraphResults(resultsActual, query) ;
  }
}

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

if (q.isConstructQuad()) {

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

private QueryExecution createQueryExecution(Query query, String queryStringToSend) {
  QueryExecution qExec = new QueryEngineHTTP(svcQuery, queryStringToSend, httpClient, httpContext);
  QueryEngineHTTP qEngine = (QueryEngineHTTP)qExec;
  // Set the accept header - use the most specific method. 
  if ( query != null ) {
    if ( query.isSelectType() && acceptSelectResult != null )
      qEngine.setAcceptHeader(acceptSelectResult);
    if ( query.isAskType() && acceptAskResult != null )
      qEngine.setAcceptHeader(acceptAskResult);
    if ( ( query.isConstructType() || query.isDescribeType() ) && acceptGraph != null )
      qEngine.setAcceptHeader(acceptGraph);
    if ( query.isConstructQuad() )
      qEngine.setDatasetContentType(acceptDataset);
  }
  // Use the general one.
  if ( qEngine.getAcceptHeader() == null && acceptSparqlResults != null )
    qEngine.setAcceptHeader(acceptSparqlResults);
  // Make sure it was set somehow.
  if ( qEngine.getAcceptHeader() == null )
    throw new JenaConnectionException("No Accept header");   
  return qExec ;
}

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

private QueryExecution createQueryExecution(Query query, String queryStringToSend) {
  QueryExecution qExec = new QueryEngineHTTP(svcQuery, queryStringToSend, httpClient, httpContext);
  QueryEngineHTTP qEngine = (QueryEngineHTTP)qExec;
  // Set the accept header - use the most specific method. 
  if ( query != null ) {
    if ( query.isSelectType() && acceptSelectResult != null )
      qEngine.setAcceptHeader(acceptSelectResult);
    if ( query.isAskType() && acceptAskResult != null )
      qEngine.setAcceptHeader(acceptAskResult);
    if ( ( query.isConstructType() || query.isDescribeType() ) && acceptGraph != null )
      qEngine.setAcceptHeader(acceptGraph);
    if ( query.isConstructQuad() )
      qEngine.setDatasetContentType(acceptDataset);
  }
  // Use the general one.
  if ( qEngine.getAcceptHeader() == null && acceptSparqlResults != null )
    qEngine.setAcceptHeader(acceptSparqlResults);
  // Make sure it was set somehow.
  if ( qEngine.getAcceptHeader() == null )
    throw new JenaConnectionException("No Accept header");   
  return qExec ;
}

代码示例来源: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: SmartDataAnalytics/jena-sparql-api

if (q.isConstructQuad()) {
  Iterator<Quad> it = qe.execConstructQuads();
  result = SPARQLResultEx.createQuads(it);

相关文章