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

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

本文整理了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

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

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

  1. public Query groupBy(Node node) {
  2. if (node != null && !contain(getGroupBy(), node)) {
  3. addGroupBy(node);
  4. }
  5. return this;
  6. }

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

  1. void orderGroup(Query q, Producer p, Mappings map){
  2. for (Mapping m : map){
  3. Node[] snode = new Node[q.getOrderBy().size()];
  4. Node[] gnode = new Node[q.getGroupBy().size()];
  5. orderGroup(q.getOrderBy(), snode, p, m);
  6. orderGroup(q.getGroupBy(), gnode, p, m);
  7. m.setOrderBy(snode);
  8. m.setGroupBy(gnode);
  9. }
  10. }

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

  1. static Mapping fake(Query q) {
  2. Mapping m = new Mapping();
  3. m.setOrderBy(new Node[q.getOrderBy().size()]);
  4. m.setGroupBy(new Node[q.getGroupBy().size()]);
  5. return m;
  6. }

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

  1. sb.append(getOrderBy());
  2. if (!getGroupBy().isEmpty()) {
  3. sb.append("\n");
  4. sb.append("group by ");
  5. sb.append(getGroupBy());

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

  1. /**
  2. * Check that select variables and expressions are compatible with group by
  3. * & aggregates use case:
  4. *
  5. * SELECT ?P (COUNT(?O) AS ?C) WHERE { ?S ?P ?O }
  6. *
  7. * SELECT ((?O1 + ?O2) AS ?O12) (COUNT(?O1) AS ?C) WHERE { ?S :p ?O1; :q ?O2
  8. * } GROUP BY (?S)
  9. *
  10. *
  11. */
  12. public boolean check() {
  13. if (getGroupBy().size() > 0) {
  14. for (Exp exp : getSelectFun()) {
  15. if (!checkGroupBy(exp)) {
  16. return false;
  17. }
  18. }
  19. } else {
  20. return checkAggregate();
  21. }
  22. return true;
  23. }

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

  1. /**
  2. * for group by ?o1 .. ?on
  3. */
  4. private Group createGroup() {
  5. if (query.isConnect()) {
  6. // group by any
  7. Merge group = new Merge(this);
  8. group.merge();
  9. return group;
  10. } else {
  11. Group group = createGroup(query.getGroupBy());
  12. return group;
  13. }
  14. }

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

  1. void count(Query q){
  2. if (q.getSelectFun().size() == 1
  3. && q.getGroupBy().isEmpty()
  4. && q.getLimit() == Integer.MAX_VALUE
  5. && ! q.isTemplate()){
  6. Exp exp = q.getSelectFun().get(0);
  7. Filter f = exp.getFilter();
  8. if (f != null
  9. && f.getExp().oper() == ExprType.COUNT
  10. && ! f.getExp().isDistinct()
  11. && f.getExp().getExpList().isEmpty()){
  12. q.setQueryProfile(Query.COUNT_PROFILE);
  13. }
  14. }
  15. }

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

  1. return true;
  2. if (member(exp.getNode(), getGroupBy())) {
  3. if (!member(var, getGroupBy())) {
  4. return false;
  5. } else if (!member(exp.getNode(), getGroupBy())) {
  6. return false;

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

  1. void count(Query q){
  2. if (q.getSelectFun().size() == 1
  3. && q.getGroupBy().isEmpty()
  4. && q.getLimit() == Integer.MAX_VALUE
  5. && ! q.isTemplate()){
  6. Exp exp = q.getSelectFun().get(0);
  7. Filter f = exp.getFilter();
  8. if (f != null
  9. && f.getExp().oper() == ExprType.COUNT
  10. && ! f.getExp().isDistinct()
  11. && f.getExp().getExpList().isEmpty()){
  12. q.setQueryProfile(Query.COUNT_PROFILE);
  13. }
  14. }
  15. }

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

  1. /**
  2. * additional filter of functional select xpath() as ?val xsd:integer(?val)
  3. * as ?int
  4. */
  5. private Mapping complete(Mapping map, Producer p) {
  6. for (Exp ee : query.getSelectFun()) {
  7. Filter f = ee.getFilter();
  8. if (f != null && !f.isFunctional()) {
  9. memory.push(map, -1);
  10. Node node = evaluator.eval(f, memory, producer);
  11. memory.pop(map);
  12. map.setNode(ee.getNode(), node);
  13. }
  14. }
  15. if (query.getOrderBy().size() > 0 || query.getGroupBy().size() > 0) {
  16. memory.push(map, -1);
  17. Mapping m = memory.store(query, p, true, true);
  18. memory.pop(map);
  19. map = m;
  20. }
  21. return map;
  22. }

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

  1. /**
  2. * Compile additional filters that may contain exists {}.
  3. */
  4. void modifier(Query q) {
  5. compile(q.getSelectFun());
  6. compile(q.getOrderBy());
  7. compile(q.getGroupBy());
  8. if (q.getHaving() != null) {
  9. compile(q.getHaving().getFilter());
  10. }
  11. for (Filter f : q.getFunList()) {
  12. compile(f);
  13. }
  14. }

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

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

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

  1. /**
  2. *
  3. * index(node) use global query index
  4. */
  5. void complete2() {
  6. for (Filter f : getPathFilter()) {
  7. index(this, f);
  8. }
  9. index(getOrderBy());
  10. index(getGroupBy());
  11. if (getHaving() != null) {
  12. index(this, getHaving().getFilter());
  13. }
  14. for (Filter f :getFunList()){
  15. index(this, f);
  16. }
  17. for (Node node : getBindingNodes()) {
  18. index(node);
  19. }
  20. for (Node node : getArgList()) {
  21. index(node);
  22. }
  23. if (getGraphNode() != null) {
  24. index(getGraphNode());
  25. }
  26. if (getPathNode() != null) {
  27. index(getPathNode());
  28. }
  29. }

相关文章