I- input symbol type
D- output domain type
public abstract class Query<I,D> extends Object
(membership) oracle, or teacher.
In LearnLib, queries are performed in a callback-like fashion: an oracle does not return the responses to the
queries, but rather invokes the
answer(Object) method on the query objects it was provided with. This allows
for implementing queries which directly react to an answered query (e.g., by modifying some internal data structure),
without the need for buffering answers. It also allows for a more efficient parallel processing of queries, as there
is no need for maintaining a common (synchronized) result data structure such as a map. However, this means that a
learner cannot rely on the
answer(Object) method of a query being called from the same thread which invoked
MembershipOracle.processQueries(java.util.Collection). If this causes concurrency issues, a safe choice is to
use queries of class
DefaultQuery, which simply store the response and make it accessible via
DefaultQuery.getOutput() for processing after the
returns, guaranteeing thread-safety.
Conceptually, a query is divided into a
prefix and a
getSuffix() suffix. The prefix
part of a query identifies a state in the (unknown) target system, whereas the suffix is the "experiment" which is
conducted on the system starting from the state to which it was transferred by the prefix. While the prefix
influences the response of the target system to a query, the answer is the directly observable reaction to
executing the suffix.
Example 1: when learning
Mealy machines, the prefix transfers the target system to a
certain state. The outputs produced by the system while executing the prefix are not part of the answer, as
the role of the prefix is limited to reaching a certain state. The reaction of the target system consists of the
output word produced while executing the suffix. Therefore, in the setting of Mealy machine learning, a valid oracle
will call the
answer(Object) method with a word of the same length as the suffix.
Example 2: when learning
DFAs, the reaction of the target system is fully determined by the state
reached by an input word. Since both prefix and suffix have the same effect on producing this output (by transferring
the system to a certain state), the response will always be a single
Boolean, and, furthermore, for every
w, the response to a query will always be the same regardless of the subdivision of
w = uv
u and suffix
v (including the corner cases
u = ε and
|Constructor and Description|
|Modifier and Type||Method and Description|
Answers the query.
Retrieves the input word of this query.
Returns the prefix part of this query.
Returns the suffix part of this query.
Returns the string representation of this query.
MembershipOracle, and only once per query to process. Calling this method more than once may result in undefined behavior, possibly (but not necessarily) throwing an exception.
output- the output, i.e., the response to the query
Copyright © 2018. All rights reserved.