本文整理了Java中org.intermine.objectstore.query.Query.getAliases
方法的一些代码示例,展示了Query.getAliases
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getAliases
方法的具体详情如下:
包路径:org.intermine.objectstore.query.Query
类名称:Query
方法名:getAliases
[英]Returns the map of QuerySelectables and FromElements to String aliases
[中]返回QuerySelectables和FromElements到字符串别名的映射
代码示例来源:origin: org.intermine/intermine-objectstore
/**
* Returns a list of aliases, where each alias corresponds to each element of the SELECT list
* of the Query object. This is effectively a list of column headings for the results object.
* @param query the Query object
* @return a List of Strings, each of which is the alias of the column
*/
public static List<String> getColumnAliases(Query query) {
List<String> columnAliases = new ArrayList<String>();
for (QuerySelectable node : query.getSelect()) {
String alias = query.getAliases().get(node);
columnAliases.add(alias);
}
return columnAliases;
}
代码示例来源:origin: intermine/intermine
/**
* Returns a list of aliases, where each alias corresponds to each element of the SELECT list
* of the Query object. This is effectively a list of column headings for the results object.
* @param query the Query object
* @return a List of Strings, each of which is the alias of the column
*/
public static List<String> getColumnAliases(Query query) {
List<String> columnAliases = new ArrayList<String>();
for (QuerySelectable node : query.getSelect()) {
String alias = query.getAliases().get(node);
columnAliases.add(alias);
}
return columnAliases;
}
代码示例来源:origin: org.intermine/intermine-objectstore
/**
* Constructs a QueryField representing the specified entry from the SELECT list of the
* specified subquery.
*
* @param q the Query object that is the subquery
* @param v the entry of the SELECT list
* @throws NullPointerException if the field name is null
*/
public QueryField(Query q, QueryEvaluable v) {
if (q == null) {
throw new NullPointerException("Subquery parameter is null");
}
this.qc = q;
this.fieldName = q.getAliases().get(v);
if (this.fieldName == null) {
throw new NullPointerException("Field not found in subquery");
}
this.secondFieldName = null;
this.type = v.getType();
}
代码示例来源:origin: intermine/intermine
/**
* Constructs a QueryField representing the specified entry from the SELECT list of the
* specified subquery.
*
* @param q the Query object that is the subquery
* @param v the entry of the SELECT list
* @throws NullPointerException if the field name is null
*/
public QueryField(Query q, QueryEvaluable v) {
if (q == null) {
throw new NullPointerException("Subquery parameter is null");
}
this.qc = q;
this.fieldName = q.getAliases().get(v);
if (this.fieldName == null) {
throw new NullPointerException("Field not found in subquery");
}
this.secondFieldName = null;
this.type = v.getType();
}
代码示例来源:origin: org.intermine/intermine-objectstore
this.fieldName = q.getAliases().get(qc);
secondFieldName = fieldName;
Class<?> fieldType = field.getReturnType();
代码示例来源:origin: intermine/intermine
this.fieldName = q.getAliases().get(qc);
secondFieldName = fieldName;
Class<?> fieldType = field.getReturnType();
代码示例来源:origin: org.intermine/intermine-objectstore
/**
* Converts a QueryReference into a String.
*
* @param q a Query, from which to get aliases
* @param ref a QueryReference
* @param parameters a List to which parameters will be added
* @return a String
*/
public static String queryReferenceToString(Query q, QueryReference ref,
List<Object> parameters) {
if (ref.getQueryClass() != null) {
return q.getAliases().get(ref.getQueryClass());
} else if (((QueryCollectionReference) ref).getQcb() != null) {
return q.getAliases().get(((QueryCollectionReference) ref).getQcb());
} else {
Object param = ((QueryCollectionReference) ref).getQcObject();
if (param == null) {
param = ((QueryCollectionReference) ref).getQcb();
}
parameters.add(param);
return "?";
}
}
代码示例来源:origin: intermine/intermine
/**
* Converts a QueryReference into a String.
*
* @param q a Query, from which to get aliases
* @param ref a QueryReference
* @param parameters a List to which parameters will be added
* @return a String
*/
public static String queryReferenceToString(Query q, QueryReference ref,
List<Object> parameters) {
if (ref.getQueryClass() != null) {
return q.getAliases().get(ref.getQueryClass());
} else if (((QueryCollectionReference) ref).getQcb() != null) {
return q.getAliases().get(((QueryCollectionReference) ref).getQcb());
} else {
Object param = ((QueryCollectionReference) ref).getQcObject();
if (param == null) {
param = ((QueryCollectionReference) ref).getQcb();
}
parameters.add(param);
return "?";
}
}
代码示例来源:origin: intermine/intermine
public void testAddTwoSimilarClassesOneToSelect() throws Exception {
QueryClass qn1 = new QueryClass(Department.class);
QueryClass qn2 = new QueryClass(Department.class);
query.addToSelect(qn1);
query.addFrom(qn2);
assertEquals("a1_", (String) query.getAliases().get(qn1));
assertEquals("a2_", (String) query.getAliases().get(qn2));
}
代码示例来源:origin: intermine/intermine
public void testAddTwoSimilarClasses() throws Exception {
QueryClass qn1 = new QueryClass(Department.class);
QueryClass qn2 = new QueryClass(Department.class);
query.addFrom(qn1);
query.addFrom(qn2);
assertEquals("a1_", (String) query.getAliases().get(qn1));
assertEquals("a2_", (String) query.getAliases().get(qn2));
}
代码示例来源:origin: intermine/intermine
public void testAddTwoSimilarClassesToSelect() throws Exception {
QueryClass qn1 = new QueryClass(Department.class);
QueryClass qn2 = new QueryClass(Department.class);
query.addToSelect(qn1);
query.addToSelect(qn2);
assertEquals("a1_", (String) query.getAliases().get(qn1));
assertEquals("a2_", (String) query.getAliases().get(qn2));
}
代码示例来源:origin: intermine/intermine
public void testAddToSelect() throws Exception {
QueryClass qn1 = new QueryClass(Department.class);
QueryClass qn2 = new QueryClass(Department.class);
QueryField qn3 = new QueryField(qn1, "name");
query.addToSelect(qn1);
assertEquals("a1_", (String) query.getAliases().get(qn1));
query.addToSelect(qn2);
assertEquals("a2_", (String) query.getAliases().get(qn2));
query.addToSelect(qn3);
assertEquals("a3_", (String) query.getAliases().get(qn3));
}
代码示例来源:origin: intermine/intermine
public void testAddTwoSimilarFields() throws Exception {
QueryClass qn1 = new QueryClass(Department.class);
QueryField qf1 = new QueryField(qn1, "name");
QueryField qf2 = new QueryField(qn1, "name");
query.addFrom(qn1);
query.addToSelect(qf1);
query.addToSelect(qf2);
assertEquals("a1_", (String) query.getAliases().get(qn1));
assertEquals("a2_", (String) query.getAliases().get(qf1));
assertEquals("a3_", (String) query.getAliases().get(qf2));
}
代码示例来源: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 void testAddTwoSimilarClassesToBoth2() throws Exception {
QueryClass qn1 = new QueryClass(Department.class);
QueryClass qn2 = new QueryClass(Department.class);
query.addToSelect(qn1);
query.addToSelect(qn2);
query.addFrom(qn1);
query.addFrom(qn2);
assertEquals("a1_", (String) query.getAliases().get(qn1));
assertEquals("a2_", (String) query.getAliases().get(qn2));
}
代码示例来源: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 testAddTwoSimilarClassesToBoth1() throws Exception {
QueryClass qn1 = new QueryClass(Department.class);
QueryClass qn2 = new QueryClass(Department.class);
query.addFrom(qn1);
query.addFrom(qn2);
query.addToSelect(qn1);
query.addToSelect(qn2);
assertEquals("a1_", (String) query.getAliases().get(qn1));
assertEquals("a2_", (String) query.getAliases().get(qn2));
}
代码示例来源:origin: intermine/intermine
private static void checkQueryClassBags(String msg, QueryClassBag qcb1, QueryClassBag qcb2, Query q1, Query q2) {
Assert.assertEquals(msg + ": QueryClassBags do not refer to the same class", qcb1.getType(), qcb2.getType());
Assert.assertEquals(msg + ": QueryClassBags do not have the same alias", q1.getAliases().get(qcb1), q2.getAliases().get(qcb2));
Assert.assertEquals(msg + ": QueryClassBags do not have the same bags", qcb1.getIds(), qcb2.getIds());
Assert.assertEquals(msg + ": QueryClassBags do not have the same osbs", qcb1.getOsb(), qcb2.getOsb());
}
}
代码示例来源:origin: intermine/intermine
subQ.alias(dep, q.getAliases().get(dep)); // W. T. F.
subQ.setDistinct(false);
subQ.addFrom(emp);
代码示例来源:origin: intermine/intermine
subQ.alias(dep, q.getAliases().get(dep)); // W. T. F.
subQ.setDistinct(false);
subQ.addFrom(emp);
内容来源于网络,如有侵权,请联系作者删除!