Jump to: navigation, search

Difference between revisions of "QUERY"


(Query and its QueryItems)
Line 3: Line 3:
 
| name = {{PAGENAME}}
 
| name = {{PAGENAME}}
 
| internalname = SystemObjects.{{PAGENAME}}
 
| internalname = SystemObjects.{{PAGENAME}}
| namespace = System.Query<br/>Custom.Query
+
| namespace = System.Query
 
| image = [[File:SY_QUERY.png|220px]]
 
| image = [[File:SY_QUERY.png|220px]]
 
| imagecaption = Query
 
| imagecaption = Query
Line 21: Line 21:
 
== Query and QueryItems ==
 
== 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 [[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]].
 
== Relation between Query and Items ==
 
 
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.
  
==Content queries==
+
==Content query ==
We often face the need to fetch a list of objects meeting arbitary criteria, for example for
+
 
 +
 
 +
Fetching a list of objects filtered by certain criteria, for example for
 
* scanning of ID markers (QR-Code, Barcode, …)
 
* scanning of ID markers (QR-Code, Barcode, …)
 
* show objects from deeper hierarchy levels
 
* show objects from deeper hierarchy levels
Line 43: Line 43:
 
* Create and relate a query context scope and set the instance as QUERY
 
* Create and relate a query context scope and set the instance as QUERY
 
* For the scope define the MetaProperties, which should be available as filter criteria on the client. Without appropriate query item, equality is used as filter operator (=)
 
* For the scope define the MetaProperties, which should be available as filter criteria on the client. Without appropriate query item, equality is used as filter operator (=)
 +
 +
== Scan query ==
 +
  
 
== Usage of DatabaseViews ==
 
== Usage of DatabaseViews ==

Revision as of 11:17, 24 March 2015

IC METACLASS.gif 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
IC Hint square.pngThere 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.

Content query

Fetching a list of objects filtered by certain criteria, for example for

  • scanning of ID markers (QR-Code, Barcode, …)
  • show objects from deeper hierarchy levels

Storing of data permanently on the device would need too much resources, hence we load the objects from server on demand. Characteristics of a content query are

  • derivative from QUERY classified as SYSCLS_QUERY marks instances as content queries
  • Related to instances via relations
  • Placed in view hierarchy defined via view items
  • Require context scopes on client side

Configuration of a content query requies

  • Set filter object (FILTEROBJECT) similar as for other query
  • Create a proper relation
  • Create a query view item and set the instance as QUERY
  • Create a relation view item and set the according default MetaClass and relation
  • Create and relate a query context scope and set the instance as QUERY
  • For the scope define the MetaProperties, which should be available as filter criteria on the client. Without appropriate query item, equality is used as filter operator (=)

Scan query

Usage of DatabaseViews

It is also possible to define a Database View and use this View for the evaluation of Queries (see VirtualContentClass).

See also