Get Started TQL

The Technopedia query language (TQL) is a structured query language that you use to query the Technopedia database.

TQL is a graph-query language that traverses nodes and relationships, which enables you to ask simple or detailed questions about assets in Technopedia.

You add the MATCH query statement as a query parameter to the /tql endpoint.
See the following example of the format and a query example:<MATCH statement> (my_alias:ASSET) RETURN my_alias LIMIT 5

MATCH statements

The MATCH statement defines the TQL query, which is like a SELECT statement in SQL. Use the MATCH statement to define the search criteria that is used to query Technopedia.

In a MATCH statement, you start by specifying a node, such as the ASSET node that represents software, hardware, and CPU, or the OWNER node that represents the manufacturer.

The following steps show how to create a simple MATCH statement:

  1. Use the MATCH clause to specify a node.
    For example, MATCH (:NODE)
  2. Assign an alias to the node so that it can be referenced by the RETURN clause to retrieve the data you want.
    For example, MATCH (alias:ASSET)
  3. To target more specific data, add node attributes.
    For example, MATCH (alias:ASSET) WHERE alias.product = 'Visual Studio'
  4. Use the RETURN clause to specify the data you want to return by referencing any assigned aliases.
    MATCH (alias:ASSET) WHERE alias.product CONTAINS 'Visual Studio' RETURN alias

### Examples of basic MATCH statements:

In this example, the MATCH clause selects the ASSET node.
The alias xyz is assigned to the node so that the RETURN clause can reference this alias and return data from the ASSET node.

MATCH (abc:ASSET) WHERE abc.owner CONTAINS 'Motorola' RETURN abc.owner, abc.product
In this example, the MATCH clause selects the ASSET node, and the alias abc is assigned to the ASSET node so that TQL can reference it with the RETURN clause to return data.

Only the owner and product attributes are returned in the query output because the RETURN clause uses the alias abc to reference them specifically. This use of the aliases enables you to be very specific about the data that you want to retrieve from Technopedia.

The following image show a partial response for the query above:
Figure 1. Query result for one Microsoft product

Structure of a MATCH statement

The following list describes the basic parts of a MATCH statement in more detail:

  • Nodes
    In a query, nodes are prefixed with a colon (:node) and both are surrounded by parentheses.
    For example, MATCH (:ASSET) or MATCH (:OWNER)
  • Aliases
    An alias is a unique name or string that you assign to a node (alias:NODE) in the query so that the RETURN clause can reference that alias to retrieve specific data.
    Assign any text string to an alias but you must not assign the same alias to two different nodes.
    MATCH (unique_alias:ASSET) or MATCH (unique_alias:OWNER)
    To return more specific data, you use the alias to reference specific attributes, for example,
    MATCH (unique_alias:ASSET) RETURN unique_alias.AttributeA, unique_alias.AttributeB
  • Attributes
    Attributes are key-value pairs that you can specify inside curly braces.
    MATCH (alias:node {version: '<value>'})
    You can also use a WHERE clause to reference attributes, for example,
    MATCH (alias:node) WHERE version = '<value> RETURN alias

The following diagram shows an outline of creating a basic query:

Figure 2. Creating a basic query

Query example one

Get any 10 assets from Technopedia.

Select the ASSET node, add an alias, and use the RETURN clause to reference the alias and retrieve asset data.


The ASSET node represents software, hardware, and CPU data, so the results might include a mixture of software, hardware, and CPU data.
To refine the query, you must include specific attributes.

The following image shows one CPU data result from the query:

Figure 3. Query result for one asset


Null values in query results

When you don't specify specific attributes by using the RETURN clause, all attributes are returned in the query output.
The examples don't show key-value pairs that have 'null' values to avoid showing multiple null values.

Query example two

Get 10 Microsoft software products.

Select the ASSET node, software class, product type, and owner attribute.

MATCH (n:ASSET {class: 'Software', type: 'Product', owner: 'Microsoft'}) RETURN n LIMIT 10

This query returns precise matches when the owner field equals 'Microsoft'.

The following image shows one result from the query:

Figure 4. Query result for one Microsoft product

Here's another way to write this query by using the WHERE, and CONTAINS clauses:

MATCH (n:ASSET {class: 'Software', type:'Product'}) WHERE n.owner CONTAINS 'Microsoft' RETURN n LIMIT 10

The difference you get by using this query is that you get results for when the owner attribute contains Microsoft, so you might get more results and the query is not case sensitive.

Query example three

Get manufacturer data for a company named Galitt.

To get manufacturer data for Galitt, you select the OWNER node, and specify the
type: Manufacturer and owner: Galitt attributes.

MATCH (n:OWNER {type: 'Manufacturer', owner: 'Galitt'}) RETURN n

The following image shows one result from the query:

Figure 5. Query result for Galitt

Query example four

Get software release information for products that have 'GoPro' in their names.

Select the ASSET node, software class, release type, and use the WHERE clause to filter the results by product name.

MATCH (n:ASSET {class: 'Software', type: 'Release'}) WHERE n.product CONTAINS 'GoPro' RETURN n LIMIT 25

This query returns data for software releases with 'GoPro' in their product names.

The following image shows one result from the query:

Figure 6. Query result for GoPro

Query example five

Get owner and edition data for software editions named 'Server'.

To get edition data, you specify the type: 'Edition' attribute.
The owner and edition attributes are child attributes of the Edition (type) attribute.

MATCH (alias:ASSET {class: 'Software', type: 'Edition', edition: 'Server'}) RETURN alias LIMIT 10

The following image shows one result from the query:

Figure 7. Query result for Server edition

To return edition and owner only, you use the following query by specifying the edition and owner attributes in the RETURN clause:

MATCH (alias:ASSET {class: 'Software', type: 'Edition', edition: 'Server'}) RETURN alias.edition, alias.owner LIMIT 10

Many attributes have child attributes that you can list by querying the parent attribute:
For example, to view the attributes for the Product attribute that belongs to Software, use the following query:

MATCH (y:ASSET {class: 'Software', type: 'Product'}) RETURN y LIMIT 1

The following image shows one result from the query:

Figure 8. Query result for Product type attribute

Using relationships in queries

To get data from more than one node in a query, you must use a relationship to join the nodes so you can retrieve related data, which is like a table join in SQL.
For example, you might want to get data for products that a specific manufacturer produces. To get this information, you query the OWNER node and use a relationship to connect to the ASSET node to find related information about assets that the manufacturer produces.

Unidirectional relationships are indicated by an arrowhead, and bidirectional relationships have no arrowhead as shown in the following image:

Figure 9. Relationship directions

Learn more about Relationships.

Query example

Get product data for the company named Gallit.

The following query returns manufacturing data for for Galitt but it does not return product data:

MATCH (n:OWNER {type:'Manufacturer', owner: 'Galitt'}) RETURN n LIMIT 1

Figure 10. Manufacturer data for Galitt

You must connect the OWNER and ASSET nodes by using the [:OWNS] Relationship type to retrieve product information.

MATCH (n:OWNER {type:'Manufacturer', owner: 'Galitt'})-[:OWNS]->(x:ASSET) RETURN x

The following example shows one result from the query that returns product data for Galitt.

Figure 11. Product data for Galitt

Learn more about TQL Queries.

Updated about a year ago

What's Next

Learn about the Data Model.

Nodes and Relationships

Get Started TQL

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.