com.hp.hpl.jena.query.Query.isDescribeType()方法的使用及代码示例

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

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

Query.isDescribeType介绍

暂无

代码示例

代码示例来源:origin: com.github.ansell.pellet/pellet-query

private static QueryType getQueryType(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: com.hp.hpl.jena/arq

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" ;
  return "<<unknown>>" ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

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" ;
  return "<<unknown>>" ;
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.jena

@Override
public ClosableIterable<Statement> sparqlDescribe(String query)
    throws ModelRuntimeException {
  Query jenaQuery = QueryFactory.create(query);
  QueryExecution qexec = QueryExecutionFactory.create(jenaQuery,
      this.dataset);
  if (jenaQuery.isDescribeType()) {
    com.hp.hpl.jena.rdf.model.Model m = qexec.execDescribe();
    Model resultModel = new ModelImplJena(null, m, Reasoning.none);
    resultModel.open();
    return resultModel;
  } else {
    throw new RuntimeException(
        "Cannot handle this type of query! Please use DESCRIBE.");
  }
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.jena

/**
 * @return opened result Model
 */
@Override
public ClosableIterable<Statement> sparqlDescribe(String queryString)
    throws ModelRuntimeException {
  assertModel();
  Query query = QueryFactory.create(queryString);
  QueryExecution qexec = QueryExecutionFactory.create(query, this.jenaModel);
  
  if(query.isDescribeType()) {
    com.hp.hpl.jena.rdf.model.Model m = qexec.execDescribe();
    Model resultModel = new ModelImplJena(null, m, Reasoning.none);
    resultModel.open();
    return resultModel;
  } else {
    throw new RuntimeException("Cannot handle this type of queries! Please use DESCRIBE.");
  }
  
}

代码示例来源:origin: com.hp.hpl.jena/arq

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: AKSW/KBox

public static ResultSet query(Query query, Model model) {
  QueryExecution qe = QueryExecutionFactory.create(query, model);
  ResultSet results = null;
  if(query.isSelectType()) {
    results = qe.execSelect();
  } else if(query.isDescribeType()) {
    Iterator<Triple> triples = qe.execDescribeTriples();
    results = new TripleResultSet(triples, model);
  } else if(query.isConstructType()) {
    Iterator<Triple> triples = qe.execConstructTriples();
    results = new TripleResultSet(triples, model);
  } else if(query.isAskType()) {
    Boolean answer = qe.execAsk();
    List<Boolean> result = new ArrayList<Boolean>();
    result.add(answer);
    results = new BooleanResultSet(result.iterator(), model);
  }
  return results;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static void executeQuery(Query query, QueryExecution queryExecution, ResultsFormat outputFormat)
{
  if ( query.isSelectType() )
    doSelectQuery(query, queryExecution, outputFormat) ;
  if ( query.isDescribeType() )
    doDescribeQuery(query, queryExecution, outputFormat) ;
  if ( query.isConstructType() )
    doConstructQuery(query, queryExecution, outputFormat) ;
  if ( query.isAskType() )
    doAskQuery(query, queryExecution, outputFormat) ;
  queryExecution.close() ;
}

代码示例来源:origin: com.github.ansell.pellet/pellet-query

public Query parse(com.hp.hpl.jena.query.Query sparql, KnowledgeBase kb) {
  this.kb = kb;
  if( sparql.isDescribeType() )
    throw new UnsupportedQueryException(
        "DESCRIBE queries cannot be answered with PelletQueryEngine" );

代码示例来源:origin: com.hp.hpl.jena/arq

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

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@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: org.apache.clerezza.ext/org.apache.jena.jena-arq

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

代码示例来源:origin: com.hp.hpl.jena/arq

public static void executeQuery(Query query, QueryExecution queryExecution, ResultsFormat outputFormat)
{
  if ( query.isSelectType() )
    doSelectQuery(query, queryExecution, outputFormat) ;
  if ( query.isDescribeType() )
    doDescribeQuery(query, queryExecution, outputFormat) ;
  if ( query.isConstructType() )
    doConstructQuery(query, queryExecution, outputFormat) ;
  if ( query.isAskType() )
    doAskQuery(query, queryExecution, outputFormat) ;
  queryExecution.close() ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

if ( query.isDescribeType() ) qType = "DESCRIBE" ;
if ( query.isConstructType() ) qType = "CONSTRUCT" ;

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

if ( query.isDescribeType() ) qType = "DESCRIBE" ;
if ( query.isConstructType() ) qType = "CONSTRUCT" ;

代码示例来源:origin: com.github.ansell.pellet/pellet-query

if( dataset.listNames().hasNext() || query.isDescribeType() ) {
  engineType = QueryEngineType.MIXED;

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public Model execDescribe(Model model)
  if ( ! query.isDescribeType() )
    throw new QueryExecException("Attempt to get a DESCRIBE result from a "+labelForQuery(query)+" query") ;

代码示例来源:origin: com.hp.hpl.jena/arq

public Model execDescribe(Model model)
  if ( ! query.isDescribeType() )
    throw new QueryExecException("Attempt to get a DESCRIBE result from a "+labelForQuery(query)+" query") ;

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

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) ;
  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) ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

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) ;
  visitor.visitDatasetDecl(this) ;
  visitor.visitQueryPattern(this) ;
  visitor.visitGroupBy(this) ;
  visitor.visitHaving(this) ;
  visitor.visitOrderBy(this) ;
  visitor.visitOffset(this) ;
  visitor.visitLimit(this) ;
  visitor.visitBindings(this) ;
  visitor.finishVisit(this) ;
}

相关文章