org.intermine.objectstore.query.Query.addToGroupBy()方法的使用及代码示例

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

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

Query.addToGroupBy介绍

[英]Add a QueryNode to the GROUP BY clause of this Query
[中]将QueryNode添加到此查询的GROUP BY子句中

代码示例

代码示例来源:origin: intermine/intermine

/**
 * Processes an AST node that describes a GROUP BY clause.
 *
 * @param ast an AST node to process
 * @param modelPackage the package for unqualified class names
 * @param iterator an iterator through the list of parameters of the IqlQuery
 */
private static void processGroupClause(AST ast, Query q, String modelPackage,
    Iterator<?> iterator) {
  do {
    q.addToGroupBy(processNewQueryNode(ast, q, modelPackage, iterator));
    ast = ast.getNextSibling();
  } while (ast != null);
}

代码示例来源:origin: org.intermine/intermine-objectstore

/**
 * Processes an AST node that describes a GROUP BY clause.
 *
 * @param ast an AST node to process
 * @param modelPackage the package for unqualified class names
 * @param iterator an iterator through the list of parameters of the IqlQuery
 */
private static void processGroupClause(AST ast, Query q, String modelPackage,
    Iterator<?> iterator) {
  do {
    q.addToGroupBy(processNewQueryNode(ast, q, modelPackage, iterator));
    ast = ast.getNextSibling();
  } while (ast != null);
}

代码示例来源:origin: org.intermine/intermine-integrate

q.addToSelect(qe3);
q.addToSelect(qfu);
q.addToGroupBy(qe3);
q.setDistinct(false);
try {

代码示例来源:origin: intermine/intermine

q.addToSelect(qe3);
q.addToSelect(qfu);
q.addToGroupBy(qe3);
q.setDistinct(false);
try {

代码示例来源:origin: intermine/intermine

public static Query selectClassFromBrokeEmployable() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Broke.class, Employable.class);
  q.addFrom(qc);
  QueryField qf = new QueryField(qc, "class");
  q.addToSelect(qf);
  q.addToSelect(new QueryFunction());
  q.addToGroupBy(qf);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query selectClassFromEmployee() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  QueryField qf = new QueryField(qc, "class");
  q.addToSelect(qf);
  q.addToSelect(new QueryFunction());
  q.addToGroupBy(qf);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query selectClassFromInterMineObject() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(InterMineObject.class);
  q.addFrom(qc);
  QueryField qf = new QueryField(qc, "class");
  q.addToSelect(qf);
  q.addToSelect(new QueryFunction());
  q.addToGroupBy(qf);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query selectClassFromEmployee() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  QueryField qf = new QueryField(qc, "class");
  q.addToSelect(qf);
  q.addToSelect(new QueryFunction());
  q.addToGroupBy(qf);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query selectClassFromBrokeEmployable() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Broke.class, Employable.class);
  q.addFrom(qc);
  QueryField qf = new QueryField(qc, "class");
  q.addToSelect(qf);
  q.addToSelect(new QueryFunction());
  q.addToGroupBy(qf);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query selectClassFromInterMineObject() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(InterMineObject.class);
  q.addFrom(qc);
  QueryField qf = new QueryField(qc, "class");
  q.addToSelect(qf);
  q.addToSelect(new QueryFunction());
  q.addToGroupBy(qf);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query whereCount() throws Exception {
  Query q = new Query();
  QueryClass qc1 = new QueryClass(Department.class);
  QueryClass qc2 = new QueryClass(Employee.class);
  q.addFrom(qc1);
  q.addFrom(qc2);
  q.addToSelect(qc1);
  QueryFunction count = new QueryFunction();
  q.addToSelect(count);
  ConstraintSet cs = new ConstraintSet(ConstraintOp.AND);
  q.setConstraint(cs);
  cs.addConstraint(new ContainsConstraint(new QueryCollectionReference(qc1, "employees"), ConstraintOp.CONTAINS, qc2));
  cs.addConstraint(new SimpleConstraint(count, ConstraintOp.GREATER_THAN, new QueryValue(new Long(1))));
  q.addToGroupBy(qc1);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query selectComplex() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  QueryClass c2 = new QueryClass(Department.class);
  QueryField f1 = new QueryField(c1, "name");
  QueryField f2 = new QueryField(c1, "vatNumber");
  QueryField f3 = new QueryField(c2, "name");
  Query q1 = new Query();
  q1.addFrom(c1);
  q1.addFrom(c2);
  QueryExpression e1 = new QueryExpression(new QueryFunction(f2, QueryFunction.AVERAGE),
      QueryExpression.ADD, new QueryValue(new Integer(20)));
  QueryFunction e2 = new QueryFunction(f2, QueryFunction.STDDEV);
  q1.addToSelect(e1);
  q1.addToSelect(e2);
  q1.addToSelect(f3);
  q1.addToSelect(c2);
  q1.addToGroupBy(c2);
  return q1;
}

代码示例来源:origin: intermine/intermine

public static Query selectComplex() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  QueryClass c2 = new QueryClass(Department.class);
  QueryField f1 = new QueryField(c1, "name");
  QueryField f2 = new QueryField(c1, "vatNumber");
  QueryField f3 = new QueryField(c2, "name");
  Query q1 = new Query();
  q1.addFrom(c1);
  q1.addFrom(c2);
  QueryExpression e1 = new QueryExpression(new QueryFunction(f2, QueryFunction.AVERAGE),
      QueryExpression.ADD, new QueryValue(new Integer(20)));
  QueryFunction e2 = new QueryFunction(f2, QueryFunction.STDDEV);
  q1.addToSelect(e1);
  q1.addToSelect(e2);
  q1.addToSelect(f3);
  q1.addToSelect(c2);
  q1.addToGroupBy(c2);
  return q1;
}

代码示例来源:origin: intermine/intermine

public static Query whereCount() throws Exception {
  Query q = new Query();
  QueryClass qc1 = new QueryClass(Department.class);
  QueryClass qc2 = new QueryClass(Employee.class);
  q.addFrom(qc1);
  q.addFrom(qc2);
  q.addToSelect(qc1);
  QueryFunction count = new QueryFunction();
  q.addToSelect(count);
  ConstraintSet cs = new ConstraintSet(ConstraintOp.AND);
  q.setConstraint(cs);
  cs.addConstraint(new ContainsConstraint(new QueryCollectionReference(qc1, "employees"), ConstraintOp.CONTAINS, qc2));
  cs.addConstraint(new SimpleConstraint(count, ConstraintOp.GREATER_THAN, new QueryValue(new Long(1))));
  q.addToGroupBy(qc1);
  q.setDistinct(false);
  return q;
}

代码示例来源:origin: intermine/intermine

public static Query generateSimpleGroupByQuery() throws Exception {
  QueryClass qc1 = new QueryClass(Company.class);
  QueryClass qc2 = new QueryClass(Department.class);
  QueryReference qr1 = new QueryCollectionReference(qc1, "departments");
  ContainsConstraint cc1 = new ContainsConstraint(qr1, ConstraintOp.CONTAINS,  qc2);
  Query q1 = new Query();
  q1.addToSelect(qc1);
  q1.addToSelect(new QueryFunction());
  q1.addFrom(qc1);
  q1.addFrom(qc2);
  q1.setConstraint(cc1);
  q1.addToGroupBy(qc1);
  return q1;
}

代码示例来源:origin: intermine/intermine

public static Query simpleGroupBy() throws Exception {
  QueryClass qc1 = new QueryClass(Company.class);
  QueryClass qc2 = new QueryClass(Department.class);
  QueryReference qr1 = new QueryCollectionReference(qc1, "departments");
  ContainsConstraint cc1 = new ContainsConstraint(qr1, ConstraintOp.CONTAINS,  qc2);
  Query q1 = new Query();
  q1.addToSelect(qc1);
  q1.addToSelect(new QueryFunction());
  q1.addFrom(qc1);
  q1.addFrom(qc2);
  q1.setConstraint(cc1);
  q1.addToGroupBy(qc1);
  return q1;
}

代码示例来源:origin: intermine/intermine

public static Query simpleGroupBy() throws Exception {
  QueryClass qc1 = new QueryClass(Company.class);
  QueryClass qc2 = new QueryClass(Department.class);
  QueryReference qr1 = new QueryCollectionReference(qc1, "departments");
  ContainsConstraint cc1 = new ContainsConstraint(qr1, ConstraintOp.CONTAINS, qc2);
  Query q1 = new Query();
  q1.addToSelect(qc1);
  q1.addToSelect(new QueryFunction());
  q1.addFrom(qc1);
  q1.addFrom(qc2);
  q1.setConstraint(cc1);
  q1.addToGroupBy(qc1);
  return q1;
}

代码示例来源:origin: intermine/intermine

public final void setUp() throws Exception {
  query = new Query();
  assertNotNull("Problem creating Query instance", query);
  // set up three queries for testing .equals() and .hashCode()
  QueryClass qc1 = new QueryClass(Company.class);
  QueryField qf1 = new QueryField(qc1, "name");
  QueryField qf2 = new QueryField(qc1, "vatNumber");
  QueryFunction f1 = new QueryFunction();  // count(*)
  QueryValue qv1 = new QueryValue("CompanyA");
  SimpleConstraint sc1 = new SimpleConstraint(qf1, ConstraintOp.NOT_EQUALS, qv1);
  clearQuery = new Query();
  clearQuery.addToSelect(qc1);
  clearQuery.addToSelect(f1);
  clearQuery.setConstraint(sc1);
  clearQuery.addToGroupBy(qc1);
  clearQuery.addToOrderBy(qf1);
}

代码示例来源:origin: intermine/intermine

QueryField name = new QueryField(contractorQc, "name");
query.addToSelect(name);
query.addToGroupBy(name);
query.addToOrderBy(name);

代码示例来源:origin: intermine/intermine

public void testWhereHavingSafe() throws Exception {
  Query q = new Query();
  QueryClass qc1 = new QueryClass(Employee.class);
  QueryField qf1 = new QueryField(qc1, "end");
  QueryField qf2 = new QueryField(qc1, "name");
  QueryFunction qf3 = new QueryFunction();
  QueryField qf4 = new QueryField(qc1, "age");
  q.addFrom(qc1);
  q.addToSelect(qf1);
  q.addToGroupBy(qf1);
  assertArrayEquals(new boolean[] {true, true}, SqlGenerator.whereHavingSafe(qf1, q));
  assertArrayEquals(new boolean[] {true, false}, SqlGenerator.whereHavingSafe(qf2, q));
  assertArrayEquals(new boolean[] {false, true}, SqlGenerator.whereHavingSafe(qf3, q));
  assertArrayEquals(new boolean[] {true, false}, SqlGenerator.whereHavingSafe(qf4, q));
  assertArrayEquals(new boolean[] {true, false}, SqlGenerator.whereHavingSafe(new SimpleConstraint(qf1, ConstraintOp.EQUALS, qf2), q));
  assertArrayEquals(new boolean[] {false, false}, SqlGenerator.whereHavingSafe(new SimpleConstraint(qf3, ConstraintOp.EQUALS, new QueryCast(qf4, Long.class)), q));
}

相关文章