本文整理了Java中net.ontopia.topicmaps.query.core.QueryResultIF.next
方法的一些代码示例,展示了QueryResultIF.next
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryResultIF.next
方法的具体详情如下:
包路径:net.ontopia.topicmaps.query.core.QueryResultIF
类名称:QueryResultIF
方法名:next
[英]PUBLIC: Steps to the next match, returning true if a valid match was found, and false if there are no more matches. Must be called before values can be returned.
[中]PUBLIC:转到下一个匹配项,如果找到有效匹配项,则返回true,如果没有其他匹配项,则返回false。必须在返回值之前调用。
代码示例来源:origin: ontopia/ontopia
/**
* Get each value of a given column from queryResult, and make a collection
* with the contents of that column.
*/
private Collection getColumn(QueryResultIF queryResult, int column) {
Collection retVal = new ArrayList();
while (queryResult.next()) {
retVal.add(queryResult.getValue(column));
}
return retVal;
}
代码示例来源:origin: ontopia/ontopia
public QueryResultIterator(QueryResultIF result) {
this.result = result;
keys = result.getColumnNames();
has_next = result.next();
}
代码示例来源:origin: ontopia/ontopia
@Override
public Object next() {
if (!has_next)
throw new NoSuchElementException();
result.getValues(values);
has_next = result.next();
return rowmap;
}
代码示例来源:origin: net.ontopia/ontopia-tmrap
private static Collection<TopicIF> getTopics(QueryResultIF result)
throws TMRAPException {
Collection<TopicIF> topics = new ArrayList<TopicIF>();
while (result.next()) {
Object current = result.getValue(0);
if (!(current instanceof TopicIF))
throw new TMRAPException(
"The query result produced by the tolog query must only contain " +
"topics, but contained an object of type " +
current.getClass().getName() + ".");
topics.add((TopicIF) current);
}
return topics;
}
代码示例来源:origin: ontopia/ontopia
private static Collection<TopicIF> getTopics(QueryResultIF result)
throws TMRAPException {
Collection<TopicIF> topics = new ArrayList<TopicIF>();
while (result.next()) {
Object current = result.getValue(0);
if (!(current instanceof TopicIF))
throw new TMRAPException(
"The query result produced by the tolog query must only contain " +
"topics, but contained an object of type " +
current.getClass().getName() + ".");
topics.add((TopicIF) current);
}
return topics;
}
代码示例来源:origin: ontopia/ontopia
/** Moves one step forward in the result set of the query.
*/
public void next() {
currentRow = nextRow;
if (!lookAhead.isEmpty())
nextRow = (Object[])lookAhead.remove(0);
else
nextRow = queryResult.next() ? queryResult.getValues() : null;
computeDifferences();
}
代码示例来源:origin: ontopia/ontopia
@Override
public Map<String, Object> next() {
if (!has_next)
throw new NoSuchElementException();
ArrayMap<String, Object> rowmap = new ArrayMap<String, Object>(keys, result.getValues());
has_next = result.next();
return rowmap;
}
代码示例来源:origin: ontopia/ontopia
public SingleQueryResultIterator(QueryResultIF result) {
this.result = result;
Object[] keys = result.getColumnNames();
values = new Object[keys.length];
rowmap = new ArrayMap(keys, values);
has_next = result.next();
}
代码示例来源:origin: ontopia/ontopia
public FlatQueryResultIterator(QueryResultIF result) {
this.result = result;
this.next_column = 0;
this.previous_row = new Object[result.getWidth()];
this.has_next = result.next();
this.next = findNext();
}
代码示例来源:origin: ontopia/ontopia
private boolean istrue(ParsedQueryIF pquery, TopicIF topic) {
QueryResultIF result = null;
try {
result = pquery.execute(Collections.singletonMap("topic", topic));
return result.next();
} catch (InvalidQueryException e) {
throw new OntopiaRuntimeException(e);
} finally {
if (result != null)
result.close();
}
}
代码示例来源:origin: net.ontopia/ontopia-webed
private void runQuery(ParsedQueryIF query, Map args) throws InvalidQueryException {
log.debug("Running query for: " + args.get("topic"));
QueryResultIF result = query.execute(args);
while (result.next()) {
for (int ix = 0; ix < result.getWidth(); ix++) {
log.debug("Removing: " + result.getValue(ix));
((TMObjectIF) result.getValue(ix)).remove();
}
}
result.close();
}
代码示例来源:origin: ontopia/ontopia
private static Set<TopicIF> queryForSet(TopicMapIF tm, String query)
throws InvalidQueryException {
Set<TopicIF> set = new CompactHashSet<TopicIF>();
QueryProcessorIF proc = QueryUtils.getQueryProcessor(tm);
QueryResultIF result = proc.execute(query);
while (result.next())
set.add((TopicIF) result.getValue(0));
result.close();
return set;
}
代码示例来源:origin: ontopia/ontopia
protected void findAny(String query) throws InvalidQueryException {
// verify that we do not get any parse or query errors
QueryResultIF result = processor.execute(query);
try {
while (result.next()) {
// just loop over rows for the sake of it
}
} finally {
result.close();
}
}
代码示例来源:origin: net.ontopia/ontopoly-editor
protected static void removeObjects(TopicMapIF topicMap, DeclarationContextIF dc, String removalQuery) throws InvalidQueryException {
QueryProcessorIF qp = QueryUtils.getQueryProcessor(topicMap);
QueryResultIF qr = null;
try {
qr = qp.execute(removalQuery, dc);
while (qr.next()) {
TMObjectIF tmobject = (TMObjectIF)qr.getValue(0);
if (tmobject.getTopicMap() != null) {
tmobject.remove();
}
}
} finally {
if (qr != null) qr.close();
}
}
代码示例来源:origin: ontopia/ontopia
protected void findNothing(String query) throws InvalidQueryException {
QueryResultIF result = processor.execute(query);
try {
assertTrue("found values, but shouldn't have",
!result.next());
} finally {
result.close();
}
}
代码示例来源:origin: ontopia/ontopia
protected void findNothing(String query, Map args) throws InvalidQueryException {
QueryResultIF result = processor.execute(query, args);
try {
assertTrue("found values, but shouldn't have",
!result.next());
} finally {
result.close();
}
}
代码示例来源:origin: ontopia/ontopia
private void process(TopicTreeNode parent) throws InvalidQueryException {
TopicIF topic = parent.getTopic();
QueryResultIF children = getChildren(topic);
while (children.next()) {
TopicIF childtopic = (TopicIF) children.getValue(0);
TopicTreeNode child = new TopicTreeNode(childtopic);
child.setAttribute("id", getId(childtopic));
child.setParent(parent);
process(child);
if (!child.getChildren().isEmpty())
child.setAttribute("action", "close");
}
}
代码示例来源:origin: ontopia/ontopia
public void testNoDotInParameter() throws IOException, InvalidQueryException {
load("family.ltm");
Map argumentMap = new HashMap();
QueryResultIF queryResult = processor.execute("topic($TOPIC)?", argumentMap);
queryResult.next();
argumentMap.put("T.T", queryResult.getValue(0));
try {
processor.execute("topic(%T.T%)?", argumentMap);
fail("The query \"topic(%T.T%)?\", which has a '.' in a parameter"
+ " parsed without failure, but should have caused"
+ "InvalidQueryException");
} catch (InvalidQueryException e) {
}
}
代码示例来源:origin: net.ontopia/ontopia-webed
private boolean noOtherReference(OccurrenceIF occurrence) {
try {
QueryProcessorIF processor =
QueryUtils.getQueryProcessor(occurrence.getTopicMap());
QueryResultIF result = processor.execute(
"select $OBJ from " +
"resource($OBJ, \"" + occurrence.getLocator().getAddress() + "\"), " +
"$OBJ /= @" + occurrence.getObjectId() + "?");
boolean other = result.next();
result.close();
return other;
} catch (InvalidQueryException e) {
throw new ActionRuntimeException(e);
}
}
代码示例来源:origin: ontopia/ontopia
public void testOptionalClauseOrdering() throws InvalidQueryException, IOException {
load("opera.ltm");
List matches = new ArrayList();
QueryResultIF result = processor.execute("{ premiere-date($OPERA, $DATE) }, " +
"date-of-birth($PERSON, $DATE)?");
while (result.next())
addMatch(matches,
"OPERA", result.getValue("OPERA"),
"DATE", result.getValue("DATE"),
"PERSON", result.getValue("PERSON"));
result.close();
verifyQuery(matches, "date-of-birth($PERSON, $DATE), " +
"{ premiere-date($OPERA, $DATE) }?");
}
内容来源于网络,如有侵权,请联系作者删除!