All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jpl.QueryInProgressException Maven / Gradle / Ivy

Go to download

Sigma knowledge engineering system is an system for developing, viewing and debugging theories in first order logic. It works with Knowledge Interchange Format (KIF) and is optimized for the Suggested Upper Merged Ontology (SUMO) www.ontologyportal.org.

There is a newer version: 2.10
Show newest version
/*This code is copyrighted by Teknowledge (c) 2003.
It is released underthe GNU Public License .
Users ofthis code also consent, by use of this code, to credit Teknowledge in any
writings, briefings,publications, presentations, or other representations of any
software which incorporates, builds on, or uses this code.*/ 

 
package jpl;



//----------------------------------------------------------------------/
// QueryInProgressException
/**
 * An exception of this type is thrown if a Query is made while 
 * another Query is in progress, for example, if the JPL programmer
 * has negglected to close a query by exhausting all solutions or by failing
 * to rweind() a Query, or in multi-threaded situations.
 * 

* To prevent this kind of exception from being thrown, first make * absolutely sure that all Queries are being closed properly, either * by exhausting all solutions in a Query (i.e., hasMoreSolutions() * returns false), or by explicitly calling rewind(). If your program * involves multi-threading, make sure you obtain the lock from the * Query object before entering a hasMoreSolutions()/nextSolution loop: *

 * Query query = // get a query somehow
 * synchronized ( jpl.Query.lock() ){
 *     while ( query.hasMoreElements() ){
 *          Hashtable solution = query.nextSolution();
 *          // process solution...
 *     }
 * }
 * 
* Note: In most situations such care is not necessary, since * the Query.query(), Query,oneSolution(), and Query.allSolutions() * methods are thread-safe. However, users may have reason * to use the hasMoreSolutions() and nextSolutions() methods, which, * while synchronized, do allow Queries to be opened between calls to * these methods. *

* If you catch this Exception, you can usese the query() accessor to * obtain a reference to the Query that is in progress. * *


* Copyright (C) 1998 Fred Dushin

* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version.

* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library Public License for more details.

*


* @author Fred Dushin * @version $Revision: 1.1.1.1 $ */ // Implementation notes: // //----------------------------------------------------------------------/ public final class QueryInProgressException extends JPLException { private Query query_ = null; protected QueryInProgressException( Query query ) { super( "QueryInProgressException: Query in progress=" + query.toString() ); this.query_ = query; } /** * @return a reference to the Query that is in progress */ public final Query query() { return this.query_; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy