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

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

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

Query.<init>介绍

[英]Creates a new empty query
[中]创建一个新的空查询

代码示例

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

/**
 * Creates a where handler with a new query.
 */
public WhereHandler() {
  this( new Query() );
}

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

/**
 * Creates a where handler with a new query.
 */
public WhereHandler() {
  this( new Query() );
}

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

/**
* Make a query - no parsing done  
*/
static public Query create() { return new Query() ; }

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

/**
 * Create a new query builder.
 */
protected AbstractQueryBuilder() {
  query = new Query();
  values = new HashMap<Var, Node>();
}

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

/**
 * Create a new query builder.
 */
protected AbstractQueryBuilder() {
  query = new Query();
  values = new HashMap<Var, Node>();
}

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

/** Create a query from the given string by calling the parser.
 *
 * @param queryString      The query string
 * @param baseURI          Base URI
 * @throws QueryException  Thrown when a parse error occurs
 */

static public Query create(String queryString, String baseURI)
{
  Query query = new Query() ;
  return parse(query, queryString, baseURI, Syntax.defaultQuerySyntax) ;
}

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

/** Create a query from the given string by calling the parser.
*
* @param queryString      The query string
* @param baseURI          Base URI
* @param syntax           {@link Syntax}
* @throws QueryException  Thrown when a parse error occurs
*/
static public Query create(String queryString, String baseURI, Syntax syntax)
{
  Query query = new Query() ;
  return parse(query, queryString, baseURI, syntax) ;
}

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

protected Query newSubQuery(Prologue progloue)
{
  return new Query(getPrologue());
}

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

public void setUpdateSink(UpdateSink sink)
{ 
  this.sink = sink ;
  this.query = new Query() ; 
  setPrologue(sink.getPrologue()) ;
}

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

/**
 * Constructor.
 */
public WhereBuilder() {
  query = new Query();
  block = new HandlerBlock(query);
  handler = block.getWhereHandler();
}

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

/**
 * Constructor.
 */
public WhereBuilder() {
  query = new Query();
  block = new HandlerBlock(query);
  handler = block.getWhereHandler();
}

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache

public QueryRunner trySelect(String queryString) {
    Stopwatch sw = Stopwatch.createStarted();

    Query query = new Query();
    query.setPrefixMapping(prefixMapping);

    QueryFactory.parse(query, queryString, "http://example.org/", syntax);

    QueryExecution qe = sparqlService.createQueryExecution(query);
    ResultSet rs = qe.execSelect();
    ResultSetFormatter.consume(rs);

    System.out.println("Time taken: " + sw.elapsed(TimeUnit.MILLISECONDS));

    return this;
  }
}

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

private Expr parseExpr(String expression) {
  Query query = new Query();
  query.setPrefixMapping(prefixHandler.getPrefixes());
  return ExprUtils.parse(query, expression, true);
}

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

private Expr parseExpr(String expression) {
  Query query = new Query();
  query.setPrefixMapping(prefixHandler.getPrefixes());
  return ExprUtils.parse(query, expression, true);
}

代码示例来源:origin: org.aksw.sparqlify/obda-api-sml

public ConstructViewDefinition(String name, String queryString, PrefixMapping prefixMapping) {
  this.name = name;
  this.query = new Query();
  
  query.setPrefixMapping(prefixMapping);
  SPARQLParser parser = SPARQLParser.createParser(Syntax.syntaxSPARQL_11);
  parser.parse(query, queryString);
  
  
  //query = QueryFactory.create("Prefix ft:<http://fintrans.publicdata.eu/ec/ontology/> Construct { ?s a ft:LabeledThing . } { ?s <"  + RDFS.label + "> ?x }", Syntax.syntaxSPARQL_11))) 
}

代码示例来源:origin: SmartDataAnalytics/Sparqlify

public ConstructViewDefinition(String name, String queryString, PrefixMapping prefixMapping) {
  this.name = name;
  this.query = new Query();
  
  query.setPrefixMapping(prefixMapping);
  SPARQLParser parser = SPARQLParser.createParser(Syntax.syntaxSPARQL_11);
  parser.parse(query, queryString);
  
  
  //query = QueryFactory.create("Prefix ft:<http://fintrans.publicdata.eu/ec/ontology/> Construct { ?s a ft:LabeledThing . } { ?s <"  + RDFS.label + "> ?x }", Syntax.syntaxSPARQL_11))) 
}

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

protected Query elementToQuery(Element pattern) {
  if ( pattern == null )
    return null;
  Query query = new Query();
  query.setQueryPattern(pattern);
  query.setQuerySelectType();
  query.setQueryResultStar(true);
  query.setResultVars();
  return query;
}

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache

public static Element limitElement(Element e, long limit) {
  Query subQuery = new Query();
  subQuery.setQuerySelectType();
  subQuery.setQueryResultStar(true);
  subQuery.setQueryPattern(e);
  subQuery.setLimit(limit);
  Element result = new ElementSubQuery(subQuery);
  return result;
}

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

default Query asQuery() {
  Element e = getElement();
  List<Var> vs = getVars();
  
  Query result = new Query();
  result.setQuerySelectType();
  result.setQueryPattern(getElement());
  result.setDistinct(true);
  
  for(Var v : vs) {
    result.getProjectVars().add(v);
  }
  return result;
}

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache

public static Query createQueryCount(Var countVar, Element e, Long limit) {
  if(limit != null) {
    e = limitElement(e, limit);
  }
  Var tmpVar = Var.alloc(countVar.getName() + "_tmp_");
  Query result = new Query();
  result.setQuerySelectType();
  result.getProject().add(countVar, new ExprAggregator(tmpVar, new AggCount()));
  result.setQueryPattern(e);
  return result;
}

相关文章