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

ClauseQuery ExampleDescription
MATCHMATCH (n:ASSET {class: 'Software'}] RETURN n LIMIT 1Describes the
pattern or criteria to search Technopedia.
RETURNMATCH (n:ASSET {class: 'Software', type: 'Product'}] RETURN n LIMIT 2Defines what to return in the results set by referring to an alias that is associated with a node or relationship.
WHEREMATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' RETURN n LIMIT 1Specify conditions to filter results by.
ANDMATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' AND n.family = "HealthMatics" RETURN n LIMIT 5Return results when the two conditions are true.
ORMATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' OR n.family = "HealthMatics" RETURN n LIMIT 5Return either one of two conditions.
LIMITMATCH (n:ASSET) RETURN n LIMIT 25Limit the number of results that are returned.
CONTAINSMATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product CONTAINS "Microsoft" RETURN n LIMIT 10Match words that are contained within an attribute field.
DISTINCTMATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product CONTAINS 'Exchange Server' RETURN DISTINCT nReturn distinct records only.
COUNTMATCH (n:ASSET {type: 'Version'}) RETURN COUNT (*)Return count of records.
ASMATCH (n:ASSET {type: 'Edition'}) RETURN n.edition AS MY_EDITIONSReturn output label as another name.
ORDER BYMATCH (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.
SKIPMATCH (n:ASSET {class: 'Software', type: 'Product'}) RETURN n SKIP 10 LIMIT 20Skip the specified number of results.
IS NULLMATCH (a:ASSET) WHERE a.cores IS NULL RETURN a.cores LIMIT 1Match cores that have a null value
IS NOT NULLMATCH (a:ASSET) WHERE a.cores IS NOT NULL RETURN a.cores LIMIT 1Match 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

OperatorQuery ExampleDescription
=









~
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 10Not equal to
>MATCH (eol:ASSET) WHERE eol.support_end_of_life_date > '2017-01-01' RETURN eol LIMIT 2Greater than
<MATCH (eol:ASSET) WHERE eol.support_end_of_life_date < '2017-01-01' RETURN eol LIMIT 2Less than
<=MATCH (eol:ASSET) WHERE eol.support_end_of_life_date >= '2017-01-01' RETURN eol LIMIT 2Greater 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/",
        }
    ]
}

Updated about a year ago

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.