[ROOT] / doc / DocFrag / ARCQuery.QueryExpression
Key | Value |
---|---|
Assembly | ARCQuery |
DocFragType | Class |
Name | QueryExpression |
Namespace | ARCQuery |
Type | QueryExpression |
ClassAttribute
Key | Value |
---|---|
AssemblyName | ARCQuery |
ClassNamespace | ARCQuery |
ClassType | QueryExpression |
Interfaces | ITypeDescriber; -IEquatable<QueryExpression>- |
InterfacesDirectlyImplemented | ITypeDescriber; -IEquatable<QueryExpression>- |
SubTypes | QueryExpressionAggregate; QueryExpressionAll; QueryExpressionCache; QueryExpressionComment; QueryExpressionDataStorage; QueryExpressionHint; QueryExpressionLimit; QueryExpressionLog; QueryExpressionOrderBy; QueryExpressionPivot; QueryExpressionRel; QueryExpressionSelect; QueryExpressionSelfCreate; QueryExpressionShuffle; QueryExpressionSkip; QueryExpressionStrict; QueryExpressionTake; QueryExpressionThenBy; QueryExpressionTitle; QueryExpressionWhere |
Represents part of a query (or actually a transformation) against a given collection and the data storage from which it was taken.
A series of queries are usually chained together in a fluent fashion
for instance as an API call like:
'api/RQ/Order/WHERE Value > 1000 NOK/REL Customer/ORDER BY LastName, FirstName/TAKE 50/'
or as a C# expression like:
'new QueryProgress(DataStorage, Orders).Where("Value > 100").Rel(typeof(Customer)).OrderBy("LastName,FirstName").Take(50)'
(but in the latter case the standard LINQ extension in .NET will of course usually provide the same or better functionality (expect for AgoRapide unique queries like QueryExpressionRel)).
See also CompoundKey which expands the concept of keys.
The main purpose of the QueryExpression concept is to empower API users to create their own simple ad-hoc reports, without needing assistance from the API developers (that is, without any C# code having to be written or new API endpoints to be created).
The QueryExpression concept is not meant to be exhaustive with relation to relational modelling, nor is it proven formally.
This concept just takes away some (or actually rather quite a lot) of the need for 'hand-crafted' code in order to cover what are quite often very common scenarios.
More complex needs can be covered by ApplicationSpecificCode implementations of this class (see below).
Note that queries can also be embedded in a Subscription (but this only gives meaning when querying against a hierarchical object storage, see AdHocQuery).
The most important implementing classes in StandardAgoRapideCode are:
QueryExpressionAll
QueryExpressionSelect
QueryExpressionWhere
QueryExpressionOrderBy
QueryExpressionSkip
QueryExpressionTake
Some classes useful for aggregation queries are:
QueryExpressionPivot
QueryExpressionAggregate
QueryExpressionRel
Self creation of collection:
QueryExpressionSelfCreate
Other implementing classes:
QueryExpressionDataStorage
QueryExpressionTitle
QueryExpressionShuffle
QueryExpressionLimit
QueryExpressionHint
QueryExpressionStrict
QueryExpressionCache
QueryExpressionComment
TODO: Potential sub-classes to be added:
-QueryExpressionUnion- (for instance like /UNION {subQuery})
Note that the concept is inherently expandable, you can create your own sub-classes and integrate them with StandardAgoRapideCode.
Note how any ApplicationSpecificCode implementations must be added to Parsers at application startup in order for them to be recognized by TryParse.
One practical application for ApplicationSpecificCode implementations of QueryExpression is hand-crafted reports, for instance a 'QueryExpressionReport042', available as for instance 'api/RQ/Report042'.
Another application could be hand-crafted HTML-representations of result sets.
See also CompoundKey (like ForeignKey, EntityMethodKey and NewKey),
FunctionKey,
QuantileKey and
ValueComparer.
The implementations of QueryExpression (together with the classes mentioned above) constitute building blocks which for instance an API end-user can fit together to construct reports as needed.
This compares well to monolithic report creation where elements can not be reused easily.
(it is similar to the UNIX philosophy of small utilities each performing a well defined easy-to-understand function).
Some online applications demonstrating QueryExpression are:
http://ARNorthwind.AgoRapide.com and
http://ARAdventureWorksOLAP.AgoRapide.com
Generated 2024-11-14 04:25:39.207 UTC