This represents either a {@link Statement} or a {@link BoundStatement}along with the query options (consistency level, whether to trace the query, ...).
A {@link Query} is used to group {@link Condition}s and produce {@link Rule}s. It's main purpose is to provide a fluent API to enable you to create rules in one line e.g.
PasseParout.when( condition1 ).and( condition2 ).then( instruction1, instruction2 );
To create a {@link Query} you need to use the {@link PassePartout#when(Condition)} method.
@see Condition @see Instruction @see Rule @noimplement This interface is not intended to be implemented by clients. @since 0.9The Query class also acts as a simple base class for GData services that support custom query parameters. These services can subclass the base Query class, add APIs to represent service query parameters, and participate in the Query URI generation process. @see Service#query(Query,Class)
Query
is a base class for all ad-hoc GDS query types. It is an abstract class allowing each query subtype to provide it's own execute method. Query
implements next method, which returns the next Document returned by the underlying query. It is important to state that the data is not materialized on the Java side until next is called. Query execution merely generates a set of candidate ids, which are then used in next
to return the actual Documents. Total number of Documents, after the query has been executed, but before a first call to next is made, is available by calling size
. Number of remaining Documents *after* at least one call to next
is available by calling itemsLeft
. Number of Documents a query can return can be limited by using limit
Important: For now only index based queries are supported, meaning data has to have been previously indexed in order for queries to work. Should an attempt be made to run a query and no index is present an exception is thrown.
IArticle
objects.
The following features are supported:
A query is abstractly represented by a composite made of implementations of this interface. The syntax can be different from parser to parser, but the {@linkplain it.unimi.dsi.mg4j.query.parser.QueryParser#parse(String) result of the parsing process} is an instance of this class.
Queries support building visits: invoking {@link #accept(QueryBuilderVisitor)} ona suitable {@link it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitor} will return an objectthat has been built by the visitor.
To this purpose, the implementation of {@link it.unimi.dsi.mg4j.query.nodes.Query#accept(QueryBuilderVisitor)}on internal nodes must gather in an array (or in an element) the results returned by the recursive calls to {@link it.unimi.dsi.mg4j.query.nodes.Query#accept(QueryBuilderVisitor)}on subnodes and pass the array (or the element) to the suitable visitPost()
method of {@link it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitor}.
Since allocating a generic array is impossible, every visitor must provide an explicit {@link it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitor#newArray(int)} method which returns an array of the correct type. @see Query @author Sebastiano Vigna
Query
interface allows applications to obtain persistent instances, values, and aggregate data from the data store. The {@link PersistenceManager} is the factory for Query
instances. There may be many Query
instances associated with a PersistenceManager
. Multiple queries might be executed simultaneously by different threads, but the implementation might choose to execute them serially. In either case, the implementation must be thread safe. There are three required elements in a Query
: the class of the results, the candidate collection of instances, and the filter.
There are optional elements: parameter declarations, variable declarations, import statements, ordering and grouping specifications, result and result class, the range of results, and flags indicating whether the query result is unique and whether the query can be modified.
The query namespace is modeled after methods in Java:
setClass
corresponds to the class definition declareParameters
corresponds to formal parameters of a method declareVariables
corresponds to local variables of a method setFilter
and setOrdering
correspond to the method body There are two namespaces in queries. Type names have their own namespace that is separate from the namespace for fields, variables and parameters.
The method setClass
introduces the name of the candidate class in the type namespace. The method declareImports
introduces the names of the imported class or interface types in the type namespace. Imported type names must be unique. When used (e.g. in a parameter declaration, cast expression, etc.) a type name must be the name of the candidate class, the name of a class or interface imported by method declareImports
, or denote a class or interface from the same package as the candidate class.
The method setClass
introduces the names of the candidate class fields.
The method declareParameters
introduces the names of the parameters. A name introduced by declareParameters
hides the name of a candidate class field of the same name. Parameter names must be unique.
The method declareVariables
introduces the names of the variables. A name introduced by declareVariables
hides the name of a candidate class field if equal. Variable names must be unique and must not conflict with parameter names.
The result of the query by default is a list of result class instances, but might be specified via setResult
. The class of the result by default is the candidate class, but might be specified via setResultClass
.
A hidden field may be accessed using the 'this' qualifier: this.fieldName
.
The Query
interface provides methods which execute the query based on the parameters given. They return a single instance or a List
of result class instances which the user can iterate to get results. The signature of the execute
methods specifies that they return an Object
which must be cast to the appropriate result by the user.
Any parameters passed to the execute
methods are used only for this execution, and are not remembered for future execution.
@version 2.1
This interface represents a SPARQL query.
There are four types of SPARQL queries: {@link SelectQuery}, {@link ConstructQuery}, {@link DescribeQuery}, and {@link AskQuery}.
@author hasanThe implementations of these objects are be provided by the underlying persistor/object store; consult its documentation.
Implementations are expected to implement the {@link #getStart()} and {@link #getCount()} methods, which are used to support range / pagingthe data. Returned result sets are expected to start from index "start", and no more than "count" items are expected.
Note: that not every object store will necessarily support this interface. In particular, the in-memory object store does not. For this, you can use the {@link Predicate} interface to similar effect, for example in{@link DomainObjectContainer#allMatches(Class,Predicate,long)}). Note that the predicate is applied within the {@link DomainObjectContainer} (ie client-side)rather than being pushed back to the object store.
Iteratorresult = userMgr.findAuthorizables(new Query() { public void build(QueryBuilder builder) { builder.setCondition(builder. and(builder. property("@name", RelationOp.EQ, valueFactory.createValue("Bob")), builder. contains("@description", "engineer"))); builder.setSortOrder("@name", Direction.ASCENDING); builder.setSelector(Selector.USER); } });
Utility class to analyze a query string of the form key1=value1&key2=value2&...
. Access is not thread-safe.
Invalid parts (not a valid key-value-pair) are omitted.
Instantiable subclasses are:
A parser for queries is contained in:
A Query is a {@link List} of {@link QueryCriteria}.
The following features are supported:
The following features are supported:
If the query specified parameters these parameters must be set (bound) before executing the query. Execution of the query will result in an enumeration of all the objects found by the query. The query can be re-executed by binding new parameters and calling the {@link #execute()} method a second time. A query can bere-execute while objects are still retrieved from a previous execution. @author Assaf Arkin @version $Revision: 7121 $ $Date: 2006-03-16 16:04:24 -0700 (Thu, 16 Mar 2006) $ @see OQLQuery @see Database#getQuery
Query query = ... myFeatureSource.getFeatures(query);
The query class is based on the Web Feature Server specification and offers a few interesting capabilities such as the ability to sort results and use a filter (similar to the WHERE clause in SQL). Additional capabilities:
The Query class supports the concepts of joins in that a query can result in a join of the feature type to other feature types in the same datastore. For example, the following would be a spatial join that selected the country that contain a particular city.
Query query = new Query("countries"); Join join = new Join("cities", CQL.toFilter("CONTAINS(geometry, b.geometry)")); join.setAlias("b"); join.setFilter(CQL.toFilter("CITY_NAME = 'Canmore'")) query.getJoins().add(join);
Example: Filter filter = CQL.toFilter("NAME like '%land'"); Query query = new Query( "countries", filter ); FeatureCollection features = featureSource.getFeatures( query );
@author Chris Holmes
@source $URL$
@version $Id$
The system works like this. Leaves of the query tree receives the complete graph and the subgraphs they return are passed to the parent query. Thus the root query is the last query to get the subgraphs and returns the final result. This querying system make possible to create query chains and complex scenario with various operators (AND, OR, ...).
Queries are built by the FilterController
from filter instances.
@author Mathieu Bastian
@see FilterController
A query is performed by instantiating this object, adding conditions to it, and then passing it to {@link Index#performQuery}.
A query can contain equals conditions on zero or more fields, and at most one range condition. The range condition should always be on the last used field. A query does not need to use all fields defined in the index, but you have to use them 'left to right'.
A query can also have an optional {@link IndexFilter}to do some additional filtering on the results, based on the fields and data stored in the index.
The structural validity of the query will be checked once the query is supplied to {@link Index#performQuery}, not while adding the individual conditions.
Query
object references a single node of this graph. ObjectSet
filled with objects of the object type that the node, it was called from, represents. Objects for all descendant nodes of the caller Query
object will be instantiated. Objects of parent nodes will not be visible in the ObjectSet
if they are not referenced from the caller Query
object.
Query
object is used to represent HTTP query parameters. Parameters are acquired by name and can be either a string, float, int, or boolean value. This ensures that data can be conveniently extracted in the correct type. This stores the parameters in a map of key value pairs. Each parameter can be acquired using the name of the parameter, if the parameter is named twice then all values can be acquired.
@author Niall Gallagher
CLAUSE PURPOSE ========= ============================================== Select Defines the variables data to be retrieved for From Defines the groups to retrieve data from Criteria Defines constraints on data retrieval ("where") GroupBy Defines how rows being returned should be grouped Having Defines how groups should be filtered, also a criteria OrderBy Defines how the results should be sorted Option Defines any extra options on the query
query = new Query(); getContentPane().add(query); String[] options = {"water", "soda", "juice", "none"}; query.addRadioButtons("radio", "Radio buttons", options, "water");@author Edward A. Lee, Manda Sutijono, Elaine Cheong @version $Id: Query.java,v 1.127 2007/12/16 07:29:47 cxh Exp $ @since Ptolemy II 0.3 @Pt.ProposedRating Yellow (eal) @Pt.AcceptedRating Red (eal)
Title: WHEX
Description:
Copyright: Copyright (c) 2003
Company:
@author igor @version 1.0Instantiable subclasses are:
A parser for queries is contained in:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|