TQL: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
m (Replaced content with "#REDIRECT Tygron Query Language")
 
(90 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{|style="border-style: solid; border-width: 20px" align="center"
#REDIRECT [[Tygron Query Language]]
|
Please note: This page is currently being updated!
|}
 
{{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 spacial area information from a specific game session on the Tygron Engine. The primary reason for its development was to make an easy to use bridge between the Tygron Engine and Microsoft Excel.
 
==Queries==
The operation used in TQL is the query, which is performed with the declarative <code>SELECT</code> statement. <code>SELECT</code> retrieves data from a running Tygron game session. The <code>SELECT</code> statements have no persistent effects on the game session itself.
 
Queries allow the user to describe desired data, leaving the Tygron Engine responsible for planning, optimizing, and performing the physical operations necessary to produce that result as it chooses.
 
A query includes a parameter to include in the final result, immediately following the <code>SELECT</code> keyword. Currently, one of the following result parameters can be chosen:
{| 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 WHERE 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 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.
|}

Latest revision as of 09:23, 20 August 2018