net.ontopia.topicmaps.query.core.QueryResultIF.getIndex()方法的使用及代码示例

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

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

QueryResultIF.getIndex介绍

[英]PUBLIC: Returns the index of the named column. Returns -1 if the column does not exist. The column index is zero-based.
[中]PUBLIC:返回命名列的索引。如果列不存在,则返回-1。列索引是从零开始的。

代码示例

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

@Override
public int getIndex(String colname) {
 return queryResult.getIndex(colname);
}

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

public int getIndex(String columnName) {
 return queryResult.getIndex(columnName);
}

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

public void testGetIndexNoSelect() throws InvalidQueryException, IOException{
 load("family.ltm");
 
 String query = "parenthood($M : mother, $F : father, $C : child)?";
 QueryResultIF result = processor.execute(query);
 assertTrue("variable M had bad index",
       result.getIndex("M") >= 0 && result.getIndex("M") < 3);
 assertTrue("variable F had bad index",
       result.getIndex("F") >= 0 && result.getIndex("F") < 3);
 assertTrue("variable C had bad index",
       result.getIndex("C") >= 0 && result.getIndex("C") < 3);
 assertTrue("non-existent variable Q was found",
       result.getIndex("Q") == -1);
}

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

/**
 * INTERNAL: Wraps a QueryResultIF instance in a suitable
 * MapCollection implementation.
 */ 
protected Collection getMapCollection(QueryResultIF result) {
 if (select != null) {
  int index = result.getIndex(select);
  if (index < 0)
 throw new IndexOutOfBoundsException("No query result column named '" + select + "'");
  List list = new ArrayList();
  while (result.next())
   list.add(result.getValue(index));
  result.close();
  return list;
 }
 if (result instanceof net.ontopia.topicmaps.query.impl.basic.QueryResult)
  // BASIC
  return net.ontopia.topicmaps.query.impl.basic.QueryResultWrappers.getWrapper(result);
 else {
  // FIXME: Should pass collection size if available.
  return IteratorUtils.toList(new QueryResultIterator(result));
 }
}

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

public void testGetIndexSelect() throws InvalidQueryException, IOException{
 load("family.ltm");
 
 String query = "select $M, $F from parenthood($M : mother, $F : father, $C : child)?";
 QueryResultIF result = processor.execute(query);
 assertTrue("variable M had bad index",
       result.getIndex("M") == 0);
 assertTrue("variable F had bad index",
       result.getIndex("F") == 1);
 assertTrue("non-existent variable Q was found",
       result.getIndex("Q") == -1);
}

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

int tix = result.getIndex("TOPIC");
int six = result.getIndex("SI");
while (result.next()) {
 TopicIF topic = (TopicIF) result.getValue(tix);

相关文章