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

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

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

Query.setDistinct介绍

[英]Set the value of the distinct property, which determines whether duplicates are permitted in the results returned by this Query
[中]设置distinct属性的值,该属性确定此查询返回的结果中是否允许重复

代码示例

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

public static Query dynamicBagConstraint2() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(new HashSet(Arrays.asList(new Class[] {Broke.class, CEO.class})));
  q.addFrom(qc);
  q.addToSelect(qc);
  q.setConstraint(new BagConstraint(qc, ConstraintOp.IN, new HashSet(Arrays.asList(new Object[] {data.get("EmployeeB1")}))));
  q.setDistinct(false);
  return q;
}

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

public static Query queryClassBagNotContainsObject() throws Exception {
  Query q = new Query();
  QueryClassBag qcb = new QueryClassBag(Department.class, Arrays.asList(new Object[] {data.get("DepartmentA1"), data.get("DepartmentB1")}));
  q.addFrom(qcb);
  q.addToSelect(new QueryField(qcb));
  q.setConstraint(new ContainsConstraint(new QueryCollectionReference(qcb, "employees"), ConstraintOp.DOES_NOT_CONTAIN, (Employee) data.get("EmployeeA1")));
  q.setDistinct(false);
  return q;
}

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

public static Query queryClassBagNotContainsObject() throws Exception {
  Query q = new Query();
  QueryClassBag qcb = new QueryClassBag(Department.class, Arrays.asList(new Object[]{data.get("DepartmentA1"), data.get("DepartmentB1")}));
  q.addFrom(qcb);
  q.addToSelect(new QueryField(qcb));
  q.setConstraint(new ContainsConstraint(new QueryCollectionReference(qcb, "employees"), ConstraintOp.DOES_NOT_CONTAIN, (Employee) data.get("EmployeeA1")));
  q.setDistinct(false);
  return q;
}

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

public static Query objectContainsObject2() throws Exception {
  Query q = new Query();
  q.addToSelect(new QueryValue("hello"));
  q.setConstraint(new ContainsConstraint(new QueryCollectionReference((InterMineObject) data.get("DepartmentA1"), "employees"), ConstraintOp.CONTAINS, (InterMineObject) data.get("EmployeeB1")));
  q.setDistinct(false);
  return q;
}

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

public static Query objectContainsObject2() throws Exception {
  Query q = new Query();
  q.addToSelect(new QueryValue("hello"));
  q.setConstraint(new ContainsConstraint(new QueryCollectionReference((InterMineObject) data.get("DepartmentA1"), "employees"), ConstraintOp.CONTAINS, (InterMineObject) data.get("EmployeeB1")));
  q.setDistinct(false);
  return q;
}

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

public static Query queryClassBagNotMM() throws Exception {
  Query q = new Query();
  QueryClassBag qcb = new QueryClassBag(HasSecretarys.class, Arrays.asList(new Object[] {data.get("CompanyA"), data.get("CompanyB"), data.get("EmployeeB1")}));
  QueryClass qc = new QueryClass(Secretary.class);
  q.addFrom(qcb);
  q.addFrom(qc);
  q.addToSelect(new QueryField(qcb));
  q.addToSelect(qc);
  q.setConstraint(new ContainsConstraint(new QueryCollectionReference(qcb, "secretarys"), ConstraintOp.DOES_NOT_CONTAIN, qc));
  q.setDistinct(false);
  return q;
}

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

public static Query containsConstraintMMCollectionRefObject() throws Exception {
  Query q1 = new Query();
  QueryClass qc = new QueryClass(Company.class);
  q1.addFrom(qc);
  q1.addToSelect(qc);
  q1.setConstraint(new ContainsConstraint(new QueryCollectionReference(qc, "contractors"),
        ConstraintOp.CONTAINS, (InterMineObject) data.get("ContractorA")));
  q1.setDistinct(false);
  return q1;
}

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

public static Query containsConstraintCollectionRefObject() throws Exception {
  Query q1 = new Query();
  QueryClass qc = new QueryClass(Department.class);
  q1.addFrom(qc);
  q1.addToSelect(qc);
  q1.setConstraint(new ContainsConstraint(new QueryCollectionReference(qc, "employees"),
      ConstraintOp.CONTAINS, (InterMineObject) data.get("EmployeeB1")));
  q1.setDistinct(false);
  return q1;
}

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

public static Query subclassCollection2() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Department.class);
  q.addFrom(qc);
  q.addToSelect(qc);
  q.addToSelect(new QueryCollectionPathExpression(qc, "employees", Broke.class, Employee.class));
  q.setDistinct(false);
  return q;
}

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

public static Query lower() throws Exception {
  Query q = new Query();
  q.setDistinct(false);
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  QueryField f = new QueryField(qc, "name");
  QueryExpression e = new QueryExpression(QueryExpression.LOWER, f);
  q.addToSelect(e);
  return q;
}

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

public static Query upper() throws Exception {
  Query q = new Query();
  q.setDistinct(false);
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  QueryField f = new QueryField(qc, "name");
  QueryExpression e = new QueryExpression(QueryExpression.UPPER, f);
  q.addToSelect(e);
  return q;
}

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

public static Query orderDescending() throws Exception {
  Query q = new Query();
  q.setDistinct(false);
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  q.addToSelect(qc);
  q.addToOrderBy(new OrderDescending(qc));
  return q;
}

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

public static Query totallyFalse() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  q.addToSelect(qc);
  ConstraintSet cs1 = new ConstraintSet(ConstraintOp.AND);
  cs1.addConstraint(new SimpleConstraint(new QueryField(qc, "age"), ConstraintOp.GREATER_THAN, new QueryValue(new Integer(3))));
  cs1.addConstraint(new ConstraintSet(ConstraintOp.OR));
  q.setConstraint(cs1);
  q.setDistinct(false);
  return q;
}

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

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

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

public static Query objectStoreBag() throws Exception {
  ObjectStoreBag osb = new ObjectStoreBag(5);
  Query q = new Query();
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  q.addToSelect(qc);
  q.setDistinct(false);
  q.setConstraint(new BagConstraint(qc, ConstraintOp.IN, osb));
  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 objectPathExpression3() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  q.addToSelect(qc);
  QueryObjectPathExpression qope1 = new QueryObjectPathExpression(qc, "department");
  qope1.addToSelect(new QueryObjectPathExpression(qope1.getDefaultClass(), "company"));
  q.addToSelect(qope1);
  q.setDistinct(false);
  return q;
}

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

public static Query constrainClass1() throws Exception {
  Query q = new Query();
  QueryClass qc1 = new QueryClass(InterMineObject.class);
  q.addFrom(qc1);
  q.addToSelect(qc1);
  QueryField qf = new QueryField(qc1, "class");
  q.setConstraint(new SimpleConstraint(qf, ConstraintOp.EQUALS, new QueryValue(Employee.class)));
  q.setDistinct(false);
  return q;
}

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

public static Query selectWhereBackslash() throws Exception {
  Query q = new Query();
  QueryClass qc = new QueryClass(Employee.class);
  q.addFrom(qc);
  q.addToSelect(qc);
  q.setConstraint(new SimpleConstraint(new QueryField(qc, "name"), ConstraintOp.EQUALS, new QueryValue("Fred\\Blog's")));
  q.setDistinct(false);
  return q;
}

相关文章