TQL: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
m (Replaced content with "#REDIRECT Tygron Query Language")
 
(71 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{being updated}}
#REDIRECT [[Tygron Query Language]]
 
{{learned|what the Tygron Query Language (TQL) is|how to create TQL queries|what type of queries you can create|what TQL is currently applied for}}
 
==TQL==
The Tygron Query Language is a special-purpose programming language designed for obtaining spatial area information during a specific project session in the Tygron Engine. The primary reason for its introduction was to bridge the gap between the Tygron Engine and Microsoft Excel.
 
==Queries==
The main operation used in TQL is the query, which is performed with the declarative <code>SELECT</code> statement. A declarative statement tells the system which data is specifically required, after which the system will retrieve the data on it's 'own'. This is contrary to an imperative statement, where the system is told 'how' to obtain said data. A <code>SELECT</code> statement retrieves data from a running Tygron project session. The <code>SELECT</code> statements have no persistent effect on the project session itself.
 
Queries in TQL using the <code>SELECT</code> statement allow the user to describe the desired data, leaving the Tygron Engine responsible for planning, optimizing, and performing the physical operations necessary to produce the desired result as output.
 
When starting a query with the <code>SELECT</code> statement, a result parameter must follow the <code>SELECT</code> keyword. Currently, one of the following result parameters can be selected:
{| class="wikitable"
|-
! Result Parameter
! Description
! Example
|-
| <code>FLOORSIZE</code>
| Floor size of buildings.
| <code>SELECT_FLOORSIZE_WHERE_CATEGORY_IS_OFFICES</code>
|-
| <code>LOTSIZE</code>
| Lot size of buildings.
| <code>SELECT_LOTSIZE_WHERE_CATEGORY_IS_OFFICES</code>
|-
| <code>UNITS</code>
| Amount of housing units.
| <code>SELECT_UNITS_WHERE_CATEGORY_IS_SOCIAL</code>
|-
| <code>DIKES</code>
| Surface space of constructed dikes or levees.
| <code>SELECT_DIKES_WHERE_ZONE_IS_1</code>
|}
 
===Comparison Predicate===
The <code>SELECT</code> and result parameter are followed by the <code>WHERE</code> statement. The <code>WHERE</code> statements includes a comparison predicate, which restricts the information taken into account by the query. The <code>WHERE</code> clause eliminates all information from the result set where the comparison predicate does not evaluate to True.
 
The comparison predicate consists of 0 or more clauses. Clauses consists of three parts;
* Clause Type
* Operator
* Value
 
====Clauses====
Some clauses are particular for constructions, others are applied to surface areas of constructions or dikes. The clause types and expected values currently supported are:
{| class="wikitable"
|-
! Clause Type
! Description
! Value Type
! Example
|-
| <code>CATEGORY</code>
| A construction belongs to the specific [[List_of_actions#Construction_Options | Function category]]
| Function category
| <code>CATEGORY_IS_INDUSTRY</code>
|-
| <code>FUNCTION</code>
| A construction belongs to a specific [[Function]]
| Function ID
| <code>FUNCTION_IS_621</code>
|-
| <code>DIKE</code>
| Surface area lies (partly) within a particular type of [[dike | Dike (or Levee)]]
| Dike ID
| <code>DIKE_IS_0</code>
|-
| <code>MAP</code>
| A construction or dike is present in the specified map or view. Also see [[#Simulation_Type | Simulation Type]]
| CURRENT or MAQUETTE
| <code>MAP_IS_MAQUETTE</code>
|-
| <code>STAKEHOLDER</code>
| A construction or surface area is owned by a specific [[Stakeholders| Stakeholder]]
| Stakeholder ID
| <code>STAKEHOLDER_IS_7</code>
|-
| <code>STAKEHOLDERTYPE</code>
| A construction or surface area is owned by stakeholders of a specific [[Stakeholders#Which_types_of_stakeholder_are_available_in_the_Tygron_Engine.3F | Stakeholder Type]]
| Stakeholder Type
| <code>STAKEHOLDERTYPE_IS_COMPANY</code>
|-
| <code>STATE</code>
| A construction resides in the specified [[#State| State]]
| State Type
| <code>STATE_IS_PENDING_CONSTRUCTION</code>
|-
| <code>TERRAIN</code>
| Surface area lies (partly) within a specific [[Terrain]]
| Terrain ID
| <code>TERRAIN_IS_1</code>
|-
| <code>TERRAINTYPE</code>
| Surface area lies (partly) within terrains with a specific [[Terrain#Terrain_Type | Type of Terrain]]
| Terrain Type
| <code>TERRAIN_IS_1</code>
|-
| <code>ZONE</code>
| Surface area lies (partly) within a specific [[Zoning|Zone]]
| Zone ID
| <code>ZONE_IS_25</code>
|}
 
====Operators====
TQL clausses currently support the following Operators:
{| class="wikitable"
|-
! Operator
! Description
! Example
|-
| <code>IS</code>
| Equal to
| <code>CATEGORY_IS_OFFICES</code>
|}
 
====Simulation Type====
Depending on the [[Simulation Type]], the map parameter is named as followed in the [[Query Tool]]:
{| class="wikitable"
|-
! Simulation Type
! <code>CURRENT</code>
! <code>MAQUETTE</code>
|-
| Planning
| <code>ORIGINAL</code>
| <code>PLANNED</code>
|-
| Timeline
| <code>TODAY</code>
| <code>MODEL</code>
|}
 
====State====
During the game sessions, constructions go from one phase to another. For example; from being planned, to being permitted, to being constructed, to being ready.
The current available states are:
{| class="wikitable"
|-
! State
! Explanation
|-
| <code>CONSTRUCTING</code>
| Construction is being constructed.
|-
| <code>CONSTRUCTION_APPROVED</code>
| Construction is approved.
|-
| <code>CONSTRUCTION_DENIED</code>
| Construction is denied.
|-
| <code>DEMOLISH_APPROVED</code>
| Demolition is approved.
|-
| <code>DEMOLISH_DENIED</code>
| Demolition is denied.
|-
| <code>DEMOLITION_FINISHED</code>
| Demolition is finished.
|-
| <code>DEMOLISHING</code>
| Construction is being demolished.
|-
| <code>NOTHING</code>
| Construction does not exist.
|-
| <code>PENDING_CONSTRUCTION</code>
| Construction is waiting for the date to be constructed.
|-
| <code>PENDING_CONSTRUCTION</code>
| Construction is waiting for the date to be constructed.
|-
| <code>PENDING_DEMOLISHING</code>
| Construction is waiting for the date to be demolished.
|-
| <code>PENDING_UPGRADE</code>
| Construction is waiting for the date to be upgraded.
|-
| <code>READY</code>
| Construction is done constructing.
|-
| <code>REQUEST_CONSTRUCTION_APPROVAL</code>
| Request is send to ask construction approval.
|-
| <code>REQUEST_DEMOLISH_APPROVAL</code>
| Request is send to ask demolition approval.
|-
| <code>REQUEST_ZONING_APPROVAL</code>
| Request is send to ask zoning approval.
|-
| <code>WAITING_FOR_DATE</code>
| Waiting to receive a date on which to start construction.
|-
| <code>WAITING_FOR_DEMOLISH_DATE</code>
| Waiting to receive a date on which to start demolition.
|}
 
==Query Construction==
In order to make it easier to construct queries, a tool has been developed to create queries in the editor, which can then be copied and used elsewhere. This tool is known as the [[Query Tool]] and more information can be found on its own page.
 
==TQL Uses==
TQL is currently used to communicate with Microsoft Excel, using the [[Excel (Indicator)|Excel Indicator]].

Latest revision as of 09:23, 20 August 2018