fr.inria.corese.kgram.core.Query.getGroupBy()方法的使用及代码示例

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

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

Query.getGroupBy介绍

暂无

代码示例

代码示例来源:origin: fr.inria.corese/kgram

Mapping store(Query q, Mapping map, Producer p) {
  Node[] gnode = new Node[q.getGroupBy().size()];
  orderGroup(q.getGroupBy(), gnode, p);
  map.setGroupBy(gnode);
  return map;
}

代码示例来源:origin: fr.inria.corese/kgram

public Query groupBy(Node node) {
  if (node != null && !contain(getGroupBy(), node)) {
    addGroupBy(node);
  }
  return this;
}

代码示例来源:origin: fr.inria.corese/kgram

void orderGroup(Query q, Producer p, Mappings map){
  for (Mapping m : map){
    Node[] snode = new Node[q.getOrderBy().size()];
    Node[] gnode = new Node[q.getGroupBy().size()];
    orderGroup(q.getOrderBy(), snode, p, m);
    orderGroup(q.getGroupBy(), gnode, p, m);
    m.setOrderBy(snode);
    m.setGroupBy(gnode);
  }
}

代码示例来源:origin: fr.inria.corese/kgram

static Mapping fake(Query q) {
  Mapping m = new Mapping();
  m.setOrderBy(new Node[q.getOrderBy().size()]);
  m.setGroupBy(new Node[q.getGroupBy().size()]);
  return m;
}

代码示例来源:origin: fr.inria.corese/kgram

sb.append(getOrderBy());
if (!getGroupBy().isEmpty()) {
  sb.append("\n");
  sb.append("group by ");
  sb.append(getGroupBy());

代码示例来源:origin: fr.inria.corese/kgram

/**
 * Check that select variables and expressions are compatible with group by
 * & aggregates use case:
 *
 * SELECT ?P (COUNT(?O) AS ?C) WHERE { ?S ?P ?O }
 *
 * SELECT ((?O1 + ?O2) AS ?O12) (COUNT(?O1) AS ?C) WHERE { ?S :p ?O1; :q ?O2
 * } GROUP BY (?S)
 *
 *
 */
public boolean check() {
  if (getGroupBy().size() > 0) {
    for (Exp exp : getSelectFun()) {
      if (!checkGroupBy(exp)) {
        return false;
      }
    }
  } else {
    return checkAggregate();
  }
  return true;
}

代码示例来源:origin: fr.inria.corese/kgram

/**
 * for group by ?o1 .. ?on
 */
private Group createGroup() {
  if (query.isConnect()) {
    // group by any
    Merge group = new Merge(this);
    group.merge();
    return group;
  } else {
    Group group = createGroup(query.getGroupBy());
    return group;
  }
}

代码示例来源:origin: fr.inria.corese/compiler

void count(Query q){
  if (q.getSelectFun().size() == 1
      && q.getGroupBy().isEmpty()
      && q.getLimit() == Integer.MAX_VALUE
      && ! q.isTemplate()){
    Exp exp = q.getSelectFun().get(0);
    Filter f = exp.getFilter();
    if (f != null 
        && f.getExp().oper() == ExprType.COUNT
        && ! f.getExp().isDistinct()
        && f.getExp().getExpList().isEmpty()){
      q.setQueryProfile(Query.COUNT_PROFILE);
    }
  }
}

代码示例来源:origin: fr.inria.corese/kgram

return true;
  if (member(exp.getNode(), getGroupBy())) {
    if (!member(var, getGroupBy())) {
      return false;
} else if (!member(exp.getNode(), getGroupBy())) {
  return false;

代码示例来源:origin: Wimmics/corese

void count(Query q){
  if (q.getSelectFun().size() == 1
      && q.getGroupBy().isEmpty()
      && q.getLimit() == Integer.MAX_VALUE
      && ! q.isTemplate()){
    Exp exp = q.getSelectFun().get(0);
    Filter f = exp.getFilter();
    if (f != null 
        && f.getExp().oper() == ExprType.COUNT
        && ! f.getExp().isDistinct()
        && f.getExp().getExpList().isEmpty()){
      q.setQueryProfile(Query.COUNT_PROFILE);
    }
  }
}

代码示例来源:origin: fr.inria.corese/kgram

/**
 * additional filter of functional select xpath() as ?val xsd:integer(?val)
 * as ?int
 */
private Mapping complete(Mapping map, Producer p) {
  for (Exp ee : query.getSelectFun()) {
    Filter f = ee.getFilter();
    if (f != null && !f.isFunctional()) {
      memory.push(map, -1);
      Node node = evaluator.eval(f, memory, producer);
      memory.pop(map);
      map.setNode(ee.getNode(), node);
    }
  }
  if (query.getOrderBy().size() > 0 || query.getGroupBy().size() > 0) {
    memory.push(map, -1);
    Mapping m = memory.store(query, p, true, true);
    memory.pop(map);
    map = m;
  }
  return map;
}

代码示例来源:origin: fr.inria.corese/kgram

/**
 * Compile additional filters that may contain exists {}.
 */
void modifier(Query q) {
  compile(q.getSelectFun());
  compile(q.getOrderBy());
  compile(q.getGroupBy());
  if (q.getHaving() != null) {
    compile(q.getHaving().getFilter());
  }
  for (Filter f : q.getFunList()) {
    compile(f);
  }
}

代码示例来源:origin: fr.inria.corese/kgram

gnode = new Node[q.getGroupBy().size()];
if (func) {                    
  orderGroup(q.getOrderBy(), snode, p);
  orderGroup(q.getGroupBy(), gnode, p);
orderGroup(q.getGroupBy(), gnode, p);

代码示例来源:origin: fr.inria.corese/kgram

/**
 *
 * index(node) use global query index
 */
void complete2() {
  for (Filter f : getPathFilter()) {
    index(this, f);
  }
  index(getOrderBy());
  index(getGroupBy());
  if (getHaving() != null) {
    index(this, getHaving().getFilter());
  }
  
  for (Filter f :getFunList()){
    index(this, f);
  }
  for (Node node : getBindingNodes()) {
    index(node);
  }
  for (Node node : getArgList()) {
    index(node);
  }
  if (getGraphNode() != null) {
    index(getGraphNode());
  }
  if (getPathNode() != null) {
    index(getPathNode());
  }
}

相关文章