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

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

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

Query.isDescribeType介绍

暂无

代码示例

代码示例来源:origin: AtomGraph/Core

/**
 * Convenience method for <pre>DESCRIBE</pre> queries.
 * 
 * @param defaultGraphUris default graph URIs
 * @param namedGraphUris named graph URIs
 * @link #loadModel(query)
 * @param query
 * @return RDF model
 */
public Model describe(Query query, List<URI> defaultGraphUris, List<URI> namedGraphUris)    
{
  if (query == null) throw new IllegalArgumentException("Query must be not null");
  if (!query.isDescribeType()) throw new IllegalArgumentException("Query must be DESCRIBE");
  
  return loadModel(query, defaultGraphUris, namedGraphUris);
}

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

public static Node extractDescribeNode(Query query) {
  if (!query.isDescribeType()) {
    throw new RuntimeException("DESCRIBE query expected. Got: ["
        + query.toString() + "]");
  }
  // TODO Right now we only support describe with a single constant.
  //Element queryPattern = query.getQueryPattern();
  if(query.getQueryPattern() != null || !query.getResultVars().isEmpty() || query.getResultURIs().size() > 1) {
    throw new RuntimeException("Sorry, DESCRIBE is only implemented for a single resource argument");
  }
  Node result = query.getResultURIs().get(0);
  return result;
}

代码示例来源:origin: com.github.galigator.openllet/openllet-jena

private static QueryType getQueryType(final Query query)
{
  if (query.isSelectType())
    return QueryType.SELECT;
  if (query.isConstructType())
    return QueryType.CONSTRUCT;
  if (query.isDescribeType())
    return QueryType.DESCRIBE;
  if (query.isAskType())
    return QueryType.ASK;
  return null;
}

代码示例来源:origin: Galigator/openllet

private static QueryType getQueryType(final Query query)
{
  if (query.isSelectType())
    return QueryType.SELECT;
  if (query.isConstructType())
    return QueryType.CONSTRUCT;
  if (query.isDescribeType())
    return QueryType.DESCRIBE;
  if (query.isAskType())
    return QueryType.ASK;
  return null;
}

代码示例来源:origin: Galigator/openllet

private static QueryType getQueryType(final Query query)
{
  if (query.isSelectType())
    return QueryType.SELECT;
  if (query.isConstructType())
    return QueryType.CONSTRUCT;
  if (query.isDescribeType())
    return QueryType.DESCRIBE;
  if (query.isAskType())
    return QueryType.ASK;
  return null;
}

代码示例来源:origin: AtomGraph/Core

/**
 * Loads RDF model from an RDF dataset using a SPARQL query.
 * Only <code>DESCRIBE</code> and <code>CONSTRUCT</code> queries can be used with this method.
 * 
 * @param dataset the RDF dataset to be queried
 * @param query query object
 * @return result RDF model
 * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#describe">DESCRIBE</a>
 * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#construct">CONSTRUCT</a>
 */
public Model loadModel(Dataset dataset, Query query)
{
  if (log.isDebugEnabled()) log.debug("Local Dataset Query: {}", query);
  if (dataset == null) throw new IllegalArgumentException("Dataset must be not null");
  if (query == null) throw new IllegalArgumentException("Query must be not null");
  
  try (QueryExecution qex = QueryExecutionFactory.create(query, dataset))
  {        
    if (query.isConstructType()) return qex.execConstruct();
    if (query.isDescribeType()) return qex.execDescribe();
  
    throw new QueryExecException("Query to load Model must be CONSTRUCT or DESCRIBE");
  }
  catch (QueryExecException ex)
  {
    if (log.isDebugEnabled()) log.debug("Local query execution exception: {}", ex);
    throw ex;
  }
}

代码示例来源:origin: AtomGraph/Core

if (query.isConstructType() || query.isDescribeType())

代码示例来源: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 void visitDescribeResultForm(Query query1)
{
  check("Not both DESCRIBE queries", query2.isDescribeType()) ;
  check("Result variables", 
     query1.getResultVars(), query2.getResultVars() ) ;
  check("Result URIs", 
     query1.getResultURIs(), query2.getResultURIs() ) ;
  
}

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

if ( ! this.isDescribeType() )
    Log.warn(this, "setResultVars(): no query pattern") ;
  return ;
if ( isDescribeType() )

代码示例来源:origin: com.github.galigator.openllet/openllet-jena

if (sparql.isDescribeType())
  throw new UnsupportedQueryException("DESCRIBE queries cannot be answered with PelletQueryEngine");

代码示例来源:origin: Galigator/openllet

if (sparql.isDescribeType())
  throw new UnsupportedQueryException("DESCRIBE queries cannot be answered with PelletQueryEngine");

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

} else if (q2.isAskType()) {
  retval.setQueryAskType();
} else if (q2.isDescribeType())

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

} else if (q2.isAskType()) {
  retval.setQueryAskType();
} else if (q2.isDescribeType())

代码示例来源: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()) {
} else if (query.isDescribeType()) {
  sTemp = new SelectHandler(aggHandler);
} else if (query.isConstructType()) {

代码示例来源: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: org.apache.jena/jena-querybuilder

} else if (query.isAskType()) {
} else if (query.isDescribeType()) {
  sTemp = new SelectHandler(aggHandler);
} else if (query.isConstructType()) {

代码示例来源: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) ;
}

相关文章