TQL Clauses and Operators

TQL clauses and operators help you to filter your queries to get the precise data that you require.

The following table lists the clauses that you use with TQL:

Table 1. TQL clauses

Clause
Query Example
Description

MATCH

MATCH (n:ASSET {class: 'Software'}] RETURN n LIMIT 1

Describes the
pattern or criteria to search Technopedia.

RETURN

MATCH (n:ASSET {class: 'Software', type: 'Product'}] RETURN n LIMIT 2

Defines what to return in the results set by referring to an alias that is associated with a node or relationship.

WHERE

MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' RETURN n LIMIT 1

Specify conditions to filter results by.

AND

MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' AND n.family = "HealthMatics" RETURN n LIMIT 5

Return results when the two conditions are true.

OR

MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' OR n.family = "HealthMatics" RETURN n LIMIT 5

Return either one of two conditions.

LIMIT

MATCH (n:ASSET) RETURN n LIMIT 25

Limit the number of results that are returned.

CONTAINS

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

Match words that are contained within an attribute field.

DISTINCT

MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product CONTAINS 'Exchange Server' RETURN DISTINCT n

Return distinct records only.

COUNT

MATCH (n:ASSET {type: 'Version'}) RETURN COUNT (*)

Return count of records.

AS

MATCH (n:ASSET {type: 'Edition'}) RETURN n.edition AS MY_EDITIONS

Return output label as another name.

ORDER BY

MATCH (n:ASSET {type: 'Version'}) RETURN n.version ORDER BY n.version ASC LIMIT 10


MATCH (n:ASSET {type: 'Version'}) RETURN n.version ORDER BY n.version DESC LIMIT 10


MATCH (a:OWNER) return a.owner, a.symbol ORDER BY a.owner, a.symbol limit 20

Sort in ascending order.




Sort in descending order.



Order by two attributes

NOTE:
Make the queries as specific as possible by using WHERE conditions and selecting specific attributes to reduce the overhead. See the notice that follows this table.

SKIP

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

Skip the specified number of results.

IS NULL

MATCH (a:ASSET) WHERE a.cores IS NULL RETURN a.cores LIMIT 1

Match cores that have a null value

IS NOT NULL

MATCH (a:ASSET) WHERE a.cores IS NOT NULL RETURN a.cores LIMIT 1

Match cores that do not have a null value

Caution when using the ORDER BY clause

Make queries as specific as possible when using the ORDER BY clause.
The ORDER BY clause adds a large processing overhead to queries that return a large amount of data.
To prevent your query from taking too long or timing out when you use the ORDER BY clause, use the following best practices:

  • Include a WHERE condition to filter the data that is returned.
  • Specify at least one attribute to make the query more specific.

The following queries from A to D are progressively faster to run because they become more specific.
Query A might time out because the ORDER BY processing load is excessive.

A. MATCH (u:ASSET) RETURN u ORDER BY u.owner

B. MATCH (a:ASSET) WHERE a.title CONTAINS 'Windows' RETURN a ORDER BY a.owner

C. MATCH (u:ASSET) WHERE u.title CONTAINS 'Network Inventory' RETURN u.owner, u.edition, u.title ORDER BY u.owner

D. MATCH (a:ASSET)<-[:OWNS]-(o:OWNER) WHERE a.technopedia_id = 'f3f988ff-eb17-4830-95ef-ed1d78c1ac33' OPTIONAL MATCH (a:ASSET)-[:MEMBER_OF]-(r:ASSET) WHERE r.type = 'Version' OR r.type = 'Model' or r.type = 'Edition' RETURN a, o, r ORDER BY r.type

The following table lists the operators that you use with TQL:

Table 2. TQL operators

Operator
Query Example
Description

=





~

MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'VIVANT' RETURN n LIMIT 10


MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product ~= 'VIvanT' RETURN n LIMIT 10

Equals



Add a (~) before the equals (=) to make the query case insensitive.

<>

MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product <> 'VIVANT' RETURN n LIMIT 10

Not equal to

>

MATCH (eol:ASSET) WHERE eol.support_end_of_life_date > '2017-01-01' RETURN eol LIMIT 2

Greater than

<

MATCH (eol:ASSET) WHERE eol.support_end_of_life_date < '2017-01-01' RETURN eol LIMIT 2

Less than

<=

MATCH (eol:ASSET) WHERE eol.support_end_of_life_date >= '2017-01-01' RETURN eol LIMIT 2

Greater than or equals

Query examples

To use the MATCH statements in the following examples, you add the MATCH statement to the following /tql endpoint and make a GET request from an API client or use cURL.

https://data.technopedia.com/tql?q=<MATCH Statement>

MATCH (eol:ASSET) WHERE eol.support_end_of_life_date >= '2017-01-01' RETURN eol LIMIT 1

RESPONSE

{
    "results": [
        {
            "eol.class": "Software",
            "eol.created_at": "2012-08-13T13:37:49Z",
            "eol.end_of_life_exception": "To be determined",
            "eol.is_suite": "FALSE",
            "eol.modified_at": "2017-05-26T14:07:25Z",
            "eol.obsolete_exception": "To be determined",
            "eol.owner": "Automatic Data Processing",
            "eol.product": "AdjustMate",
            "eol.release": "Automatic Data Processing AdjustMate 3.0",
            "eol.support_end_of_life_date": "2999-12-31T00:00:00Z",
            "eol.support_obsolete_date": "2999-12-31T00:00:00Z",
            "eol.technopedia_id": "3a6fea3c-3606-4e72-b0f8-d090bcc976fd",
            "eol.title": "Automatic Data Processing AdjustMate 3.0",
            "eol.type": "Release",
            "eol.url": 
            "http://www.itninja.com/software/automatic-data-processing/adp-adjustmate/3-2810",
            "eol.version": "3.0",
            "eol.version_group": "3",
            "eol.version_order": "3"
        }
    ]
{    
MATCH (n:ASSET {class: 'Software', type: 'Product'}) 
WHERE n.product CONTAINS 'Exchange Server' 
RETURN DISTINCT n LIMIT 1

RESPONSE

{
    "results": [
        {
            "n.alias": "HEAT Software GoldMine Integration Services for Microsoft Exchange Server",
            "n.class": "Software",
            "n.created_at": "2018-03-14T09:35:13Z",
            "n.family": "GoldMine",
            "n.is_suite": "FALSE",
            "n.modified_at": "2018-03-14T09:35:13Z",
            "n.owner": "Ivanti",
            "n.product": "Integration Services for Microsoft Exchange Server",
            "n.technopedia_id": "f2a247c9-f9b1-4db1-94ac-1f4952534b63",
            "n.title": "Ivanti GoldMine Integration Services for Microsoft Exchange Server",
            "n.type": "Product",
            "n.url": "http://support.frontrange.com/kbcontent/gmis/gm_is_exchange_getting_started_guide.pdf",
        }
    ]
}

MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' AND n.family = "HealthMatics" RETURN n LIMIT 1

RESPONSE

{
    "results": [
        {
            "n.class": "Software",
            "n.created_at": "2007-04-22T04:55:16Z",
            "n.family": "HealthMatics",
            "n.modified_at": "2017-06-01T10:44:00Z",
            "n.owner": "Allscripts Healthcare Solutions",
            "n.product": "Office",
            "n.technopedia_id": "01f51f64-549a-4058-bf86-43d8fa801cc1",
            "n.title": "Allscripts Healthcare Solutions HealthMatics Office",
            "n.type": "Product",
            "n.url": "http://investor.allscripts.com/",
        }
    ]
}

TQL Clauses and Operators


Suggested Edits are limited on API Reference Pages

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