TQL: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
Line 47: Line 47:


====Clauses====
====Clauses====
The clause types and expected values currently supported are:
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"
{| class="wikitable"
|-
|-
Line 66: Line 66:
|-
|-
| <code>DIKE</code>
| <code>DIKE</code>
| A construction is constructed or planned on top of a particular type of [[dike | Dike (or Levee)]]  
| Surface area lies (partly) within a particular type of [[dike | Dike (or Levee)]]  
| Dike ID
| Dike ID
| <code>DIKE_IS_0</code>
| <code>DIKE_IS_0</code>
|-
|-
| <code>MAP</code>
| <code>MAP</code>
| A construction is present in the specified map or view. Also see [[#Simulation_Type | Simulation Type]]  
| A construction or dike is present in the specified map or view. Also see [[#Simulation_Type | Simulation Type]]  
| CURRENT or MAQUETTE
| CURRENT or MAQUETTE
| <code>MAP_IS_MAQUETTE</code>
| <code>MAP_IS_MAQUETTE</code>
|-
|-
| <code>STAKEHOLDER</code>
| <code>STAKEHOLDER</code>
| A construction is owned by a specific [[Stakeholders| Stakeholder]]  
| A construction or surface area is owned by a specific [[Stakeholders| Stakeholder]]  
| Stakeholder ID
| Stakeholder ID
| <code>STAKEHOLDER_IS_7</code>
| <code>STAKEHOLDER_IS_7</code>
|-
|-
| <code>STAKEHOLDERTYPE</code>
| <code>STAKEHOLDERTYPE</code>
| A construction is owned by stakeholders of a specific [[Stakeholders#Which_types_of_stakeholder_are_available_in_the_Tygron_Engine.3F | Stakeholder Type]]  
| 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
| Stakeholder Type
| <code>STAKEHOLDERTYPE_IS_COMPANY</code>
| <code>STAKEHOLDERTYPE_IS_COMPANY</code>
|-
|-
| <code>MAP</code>
| <code>STATE</code>
| A buildings belongs to the specified [[function category | Function category]]  
| A construction resides in the specified [[#State]]
| Function category
| State Type
| <code>Function category</code>
| <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>MAP</code>
| <code>ZONE</code>
| A buildings belongs to the specified [[function category | Function category]]  
| Surface area lies (partly) within a specific [[Zone]]  
| Function category
| Zone ID
| <code>Function category</code>
| <code>ZONE_IS_25</code>
|}
|}



Revision as of 16:27, 30 June 2015

Please note: This page is currently being updated!

Template:Learned

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 SELECT statement. SELECT retrieves data from a running Tygron game session. The SELECT 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 SELECT keyword. Currently, one of the following result parameters can be chosen:

Result Parameter Description Example
FLOORSIZE Floor size of buildings. SELECT_FLOORSIZE_WHERE_CATEGORY_IS_OFFICES
LOTSIZE Lot size of buildings. SELECT_LOTSIZE_WHERE_CATEGORY_IS_OFFICES
UNITS Amount of housing units. SELECT_UNITS_WHERE_CATEGORY_IS_SOCIAL
DIKES Surface space of constructed dikes or levees. SELECT_DIKES_WHERE_ZONE_IS_1

Comparison Predicate

The SELECT and result parameter are followed by the WHERE statement. The WHERE 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:

Clause Type Description Value Type Example
CATEGORY A construction belongs to the specific Function category Function category CATEGORY_IS_INDUSTRY
FUNCTION A construction belongs to a specific Function Function ID FUNCTION_IS_621
DIKE Surface area lies (partly) within a particular type of Dike (or Levee) Dike ID DIKE_IS_0
MAP A construction or dike is present in the specified map or view. Also see Simulation Type CURRENT or MAQUETTE MAP_IS_MAQUETTE
STAKEHOLDER A construction or surface area is owned by a specific Stakeholder Stakeholder ID STAKEHOLDER_IS_7
STAKEHOLDERTYPE A construction or surface area is owned by stakeholders of a specific Stakeholder Type Stakeholder Type STAKEHOLDERTYPE_IS_COMPANY
STATE A construction resides in the specified #State State Type STATE_IS_PENDING_CONSTRUCTION
TERRAIN Surface area lies (partly) within a specific Terrain Terrain ID TERRAIN_IS_1
TERRAINTYPE Surface area lies (partly) within terrains with a specific Type of Terrain Terrain Type TERRAIN_IS_1
ZONE Surface area lies (partly) within a specific Zone Zone ID ZONE_IS_25

Operators

TQL clausses currently support the following Operators:

Operator Description Example
IS Equal to CATEGORY_IS_OFFICES

Simulation Type

Depending on the Simulation Type, the map parameter is named as followed in the Query Tool:

Simulation Type CURRENT MAQUETTE
Planning ORIGINAL PLANNED
Timeline TODAY MODEL