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

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

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

Query.alias介绍

[英]Set an alias for an element in the Query.
[中]为查询中的元素设置别名。

代码示例

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

/**
 * Adds a FromElement to the FROM clause of this Query
 *
 * @param cls the FromElement to be added
 */
@Override
public void addFrom(FromElement cls) {
  if (cls == null) {
    throw new NullPointerException("cls must not be null");
  }
  iqlQuery = null;
  queryClasses.add(cls);
  alias(cls, null);
}

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

/**
 * Adds a FromElement to the FROM clause of this Query
 *
 * @param cls the FromElement to be added
 */
@Override
public void addFrom(FromElement cls) {
  if (cls == null) {
    throw new NullPointerException("cls must not be null");
  }
  iqlQuery = null;
  queryClasses.add(cls);
  alias(cls, null);
}

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

/**
 * Add a QuerySelectable to the SELECT clause of this Query
 *
 * @param node the QuerySelectable to add
 */
public void addToSelect(QuerySelectable node) {
  iqlQuery = null;
  select.add(node);
  if (node instanceof PathExpressionField) {
    alias(((PathExpressionField) node).getQope(), null);
  }
  alias(node, null);
}

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

/**
 * Add a QuerySelectable to the SELECT clause of this Query
 *
 * @param node the QuerySelectable to add
 */
public void addToSelect(QuerySelectable node) {
  iqlQuery = null;
  select.add(node);
  if (node instanceof PathExpressionField) {
    alias(((PathExpressionField) node).getQope(), null);
  }
  alias(node, null);
}

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

/**
 * Add a QuerySelectable to the SELECT clause of this Query
 *
 * @param node the QuerySelectable to add
 * @param alias the alias for this FromElement
 * @return the updated Query
 */
public Query addToSelect(QuerySelectable node, String alias) {
  iqlQuery = null;
  select.add(node);
  if (node instanceof PathExpressionField) {
    alias(((PathExpressionField) node).getQope(), null);
  }
  alias(node, alias);
  return this;
}

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

/**
 * Adds a FromElement to the FROM clause of this Query
 *
 * @param cls the FromElement to be added
 * @param alias the alias for this FromElement
 * @return the updated Query
 */
public Query addFrom(FromElement cls, String alias) {
  if (cls == null) {
    throw new NullPointerException("cls must not be null");
  }
  iqlQuery = null;
  queryClasses.add(cls);
  alias(cls, alias);
  return this;
}

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

/**
 * Adds a FromElement to the FROM clause of this Query
 *
 * @param cls the FromElement to be added
 * @param alias the alias for this FromElement
 * @return the updated Query
 */
public Query addFrom(FromElement cls, String alias) {
  if (cls == null) {
    throw new NullPointerException("cls must not be null");
  }
  iqlQuery = null;
  queryClasses.add(cls);
  alias(cls, alias);
  return this;
}

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

/**
 * Add a QuerySelectable to the SELECT clause of this Query
 *
 * @param node the QuerySelectable to add
 * @param alias the alias for this FromElement
 * @return the updated Query
 */
public Query addToSelect(QuerySelectable node, String alias) {
  iqlQuery = null;
  select.add(node);
  if (node instanceof PathExpressionField) {
    alias(((PathExpressionField) node).getQope(), null);
  }
  alias(node, alias);
  return this;
}

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

public void testAlias1() throws Exception {
  Query q = new Query();
  String s1 = "one";
  q.alias(s1, "alias1");
  try {
    q.alias(s1, "alias2");
    fail("Expected: IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}

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

public void testAlias2() throws Exception {
  Query q = new Query();
  String s1 = "one";
  String s2 = "two";
  q.alias(s1, "alias1");
  try {
    q.alias(s2, "alias1");
    fail("Expected: IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}

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

public void testAlias3() throws Exception {
  Query q = new Query();
  String s1 = "one";
  q.alias(s1, "alias1");
  q.alias(s1, null);
  assertEquals(Collections.singletonMap(s1, "alias1"), q.getAliases());
}

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

public void testAlias4() throws Exception {
  Query q = new Query();
  String s1 = "one";
  q.alias(s1, "alias1");
  q.alias(s1, "alias1");
  assertEquals(Collections.singletonMap(s1, "alias1"), q.getAliases());
}

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

public static Query bagConstraint2() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  Query q1 = new Query();
  q1.alias(c1, "Company");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  Set set = new LinkedHashSet();
  set.add(data.get("CompanyA"));
  q1.setConstraint(new BagConstraint(c1, ConstraintOp.IN, set));
  return q1;
}

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

public static Query bagConstraint2() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  Query q1 = new Query();
  q1.alias(c1, "Company");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  Set set = new LinkedHashSet();
  set.add(data.get("CompanyA"));
  q1.setConstraint(new BagConstraint(c1, ConstraintOp.IN, set));
  return q1;
}

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

public static Query bagConstraint() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  Query q1 = new Query();
  q1.alias(c1, "Company");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  HashSet set = new LinkedHashSet();
  set.add("hello");
  set.add("goodbye");
  set.add("CompanyA");
  q1.setConstraint(new BagConstraint(new QueryField(c1, "name"), ConstraintOp.IN, set));
  return q1;
}

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

public static Query subQuery() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  QueryValue v1 = new QueryValue(new Integer(5));
  Query q1 = new Query();
  q1.alias(c1, "Array");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  q1.alias(v1, "Alias");
  q1.addToSelect(v1);
  Query q2 = new Query();
  q2.alias(q1, "All");
  q2.addFrom(q1);
  QueryField f1 = new QueryField(q1, c1, "name");
  QueryField f2 = new QueryField(q1, v1);
  q2.addToSelect(f1);
  q2.alias(f2, "Alias");
  q2.addToSelect(f2);
  return q2;
}

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

public static Query bagConstraint() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  Query q1 = new Query();
  q1.alias(c1, "Company");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  HashSet set = new LinkedHashSet();
  set.add("hello");
  set.add("goodbye");
  set.add("CompanyA");
  q1.setConstraint(new BagConstraint(new QueryField(c1, "name"), ConstraintOp.IN, set));
  return q1;
}

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

public static Query selectSimpleObject() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  Query q1 = new Query();
  q1.setDistinct(false);
  q1.alias(c1, "Alias");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  return q1;
}

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

public static Query generateSelectSimpleObjectQuery() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  Query q1 = new Query();
  q1.setDistinct(false);
  q1.alias(c1, "Alias");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  return q1;
}

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

public static Query selectSimpleObject() throws Exception {
  QueryClass c1 = new QueryClass(Company.class);
  Query q1 = new Query();
  q1.setDistinct(false);
  q1.alias(c1, "Alias");
  q1.addFrom(c1);
  q1.addToSelect(c1);
  return q1;
}

相关文章