Difference between revisions of "QUERY"
Line 22: | Line 22: | ||
A Query is defined for a single [[MetaClass]], where the MetaClass is defined in the property '''FILTEROBJECT'''. Once a query is evaluated it will deliver a list of objects of type ContentClasses (instances), filtered as defined by its [[QUERYITEM|QueryItems]]. | A Query is defined for a single [[MetaClass]], where the MetaClass is defined in the property '''FILTEROBJECT'''. Once a query is evaluated it will deliver a list of objects of type ContentClasses (instances), filtered as defined by its [[QUERYITEM|QueryItems]]. | ||
The correspondence between Queries and its items is created and stored by a relationship [[SYSREL_QUERY]]. Therefore a single QueryItem can be used several times for different Queries. | The correspondence between Queries and its items is created and stored by a relationship [[SYSREL_QUERY]]. Therefore a single QueryItem can be used several times for different Queries. | ||
+ | |||
+ | The "FILTEROBJECT" of a query describes the target MetaClass to find instances of. E.g., if I want to find pumps, a MetaClass "MC_PUMP" can be used as filter target. The query items of a query describe filters for property values. E.g., a query item could specify that only objects with a value larger than "12" in the "VOLTAGE" MetaProperty should be retrieved. Multiple query items can be connected logically (AND/OR) so all of them or just some (or one) of them need to match. | ||
==Content query == | ==Content query == |
Revision as of 16:40, 3 December 2019
Query | |
---|---|
Name | QUERY |
Namespace | System.Query |
Internal Name | SystemObjects.QUERY |
TypeString | UBIK.Kernel.MetaClass |
RuntimeType | UBIK.Kernel.Query |
Purpose | Configure queries |
Version | 2+ |
In UBIK, queries are used for fetching a list of ContentClasses from the database. Queries use data base mechanism for perfomant data access and will deliver a list of objects of a certain Metaclass. Queries can be used in different scenarios:
- data fetching (n records)
- finding a single or a set of recordset(s)
- used as definition of root nodes in a View
There are specific methods available for this type! |
Query and QueryItems
A Query is defined for a single MetaClass, where the MetaClass is defined in the property FILTEROBJECT. Once a query is evaluated it will deliver a list of objects of type ContentClasses (instances), filtered as defined by its QueryItems. The correspondence between Queries and its items is created and stored by a relationship SYSREL QUERY. Therefore a single QueryItem can be used several times for different Queries.
The "FILTEROBJECT" of a query describes the target MetaClass to find instances of. E.g., if I want to find pumps, a MetaClass "MC_PUMP" can be used as filter target. The query items of a query describe filters for property values. E.g., a query item could specify that only objects with a value larger than "12" in the "VOLTAGE" MetaProperty should be retrieved. Multiple query items can be connected logically (AND/OR) so all of them or just some (or one) of them need to match.
Content query
Objects can be loaded on demand from the server, as storing a huge amount of data permanently on the device would need too much resources. A content query is a Query instance classified as SYSCLS QUERY and can be related to other content objects. For being shown in the View hierarchy it is necessary to create a QueryViewItem for the query object itself. Further on, for being published to the client a Query Scopes has to be created and added to the ACM.
The result of the query depends on the network connection and the UBIK® sync mode and follows the same rules as Searching for objects by Optical codes.
Scan query
Objects can be searched by optical codes (e.g. Barcode, QR code) using a scan query.
See detailed articles on How to prepare the object and How to find objects on the client.
Usage of DatabaseViews
It is also possible to define a Database View and use this View for the evaluation of Queries (see VirtualContentClass).