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

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

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

Query.setQueryPattern介绍

暂无

代码示例

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

@Override
  public void exec(ARQParser parser) throws Exception
  {
    Element el = parser.GroupGraphPattern() ;
    query.setQueryPattern(el) ;
  }
} ;

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

@Override
public void visitQueryPattern(Query query) {
  newQuery.setQueryPattern(query.getQueryPattern());
}

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

private static Query toQuery(Element pattern) {
  Query query = QueryFactory.make() ;
  query.setQueryPattern(pattern) ;
  query.setQuerySelectType() ;
  query.setQueryResultStar(true) ;
  return query ;
}

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

/**
 * Process for a single pattern below the modifiers.
 * Cleans up the ElementGroup produced.
 */

private void processQueryPattern(QueryLevelDetails level) {
  Op op = level.pattern ;
  op.visit(this) ;
  ElementGroup eg = this.currentGroup ;
  Element e = fixupGroupsOfOne(eg) ;
  query.setQueryPattern(e) ;
  query.setQuerySelectType() ;
}

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

public static Query fixVarNames(Query query) {
  Query result = query.cloneQuery();
  Element element = query.getQueryPattern();
  Element repl = ElementUtils.fixVarNames(element);
  result.setQueryPattern(repl);
  return result;
}

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

public static Query transform(Query query, Map<Node, BinaryRelation> virtualPredicates, boolean cloneOnChange) {
  Element oldQueryPattern = query.getQueryPattern();
  Element newQueryPattern = transform(oldQueryPattern, virtualPredicates);
  Query result;
  if(oldQueryPattern == newQueryPattern) {
    result = query;
  } else {
    result = cloneOnChange ? query.cloneQuery() : query;
    result.setQueryPattern(newQueryPattern);
  }
  return result;
}

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

@Override
public void setVars(Map<Var, Node> values) {
  if (values.isEmpty()) {
    return;
  }
  Element e = query.getQueryPattern();
  if (e != null) {
    ElementRewriter r = new ElementRewriter(values);
    e.visit(r);
    query.setQueryPattern(r.getResult());
  }
  valuesHandler.setVars(values);
}

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

final public void WhereClause() throws ParseException {
           Element el ;
 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 case WHERE:
  jj_consume_token(WHERE);
  break;
 default:
  jj_la1[15] = jj_gen;
  ;
 }
 el = GroupGraphPattern();
                    getQuery().setQueryPattern(el) ;
}

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

public static Query wrapAsSubQuery(Query query) {
  Element esq = new ElementSubQuery(query);
  Query result = new Query();
  result.setQuerySelectType();
  result.setQueryResultStar(true);
  result.setQueryPattern(esq);
  return result;
}

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

public static Query wrapAsSubQuery(Query query, Var v) {
  Element esq = new ElementSubQuery(query);
  Query result = new Query();
  result.setQuerySelectType();
  result.getProject().add(v);
  result.setQueryPattern(esq);
  return result;
}

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

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

public static Query createSubQuery(Query query, Var var) {
  Element esq = new ElementSubQuery(query);
  Query result = new Query();
  result.setQuerySelectType();
  result.getProject().add(var);
  result.setQueryPattern(esq);
  return result;
}

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

private void processQueryPattern(Op op, List<OpExtend> assignments) {
  op.visit(this) ;
  ElementGroup eg = this.currentGroup ;
  processExtends(assignments,(v,e)->eg.addElement(new ElementBind(v, e)) ) ;
  Element e = fixupGroupsOfOne(eg) ;
  query.setQueryPattern(e) ;
  query.setQuerySelectType() ;
}

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

@Override
public void visit(ElementSubQuery el) {
  WhereHandler other = new WhereHandler( el.getQuery() );
  other.build();
  if (other.getElement() != el.getQuery().getQueryPattern())
  {
    el.getQuery().setQueryPattern( other.getQuery().getQueryPattern() );
  }
  result = el;
}

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

@Override
public void visit(ElementSubQuery el) {
  WhereHandler other = new WhereHandler( el.getQuery() );
  other.build();
  if (other.getElement() != el.getQuery().getQueryPattern())
  {
    el.getQuery().setQueryPattern( other.getQuery().getQueryPattern() );
  }
  result = el;
}

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

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

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

相关文章