TQL Queries

This section provides more detailed information about the Technopedia query language (TQL) that follows on from the Get Started TQL section.

TQL is based on the Cypher query language.
In a TQL query, you use the MATCH statement to select a node, assign an alias, and use the RETURN clause to reference the assigned alias to retrieve data.

You add the MATCH query statement as a query parameter to the /tql endpoint.
The following example shows the HTTP GET request format and a TQL query example:

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

https://data.technopedia.com/tql?q=MATCH (my_alias:ASSET) RETURN my_alias LIMIT 5

TQL query structure

The following query syntax and examples represent the basic requirements for most queries:

MATCH node

MATCH (<alias>:<node>) RETURN <alias>
Use MATCH to select a Technopedia node such as ASSET or OWNER, and then assign an alias to the node so that it can be referenced by the RETURN clause.


The following examples return data from the ASSET and OWNER nodes:
MATCH (alias:ASSET) RETURN alias

MATCH(alias:OWNER) RETURN alias

Match node and specify an attribute

MATCH (<alias>:<node> {<attribute>: <'value'>}) RETURN <alias.attribute>


The following examples include attributes that target specific data:
MATCH (alias:ASSET {type: 'Version'}) RETURN alias.version
Retrieves version data that is called by the RETURN clause, which specifies the version attribute`

MATCH (alias:ASSET {type: 'Edition'}) RETURN alias.owner
Some attributes such as owner or version might be returned for more than one type attribute, if the type attribute is not specified.

Match node and filter by attribute

MATCH (<alias>:<node> {<attribute>: <'value'>}) WHERE <alias>.<attribute> = '<value>' RETURN <alias>


This query returns specific results for software products that match 'Office' in their product name.
MATCH (n:ASSET {class: 'Software', type: 'Product'}) WHERE n.product = 'Office' RETURN n LIMIT 1



The ASSET node incorporates software, hardware, and CPU data, so it's a likely target for most queries.

There are two important concepts that you must understand to query the ASSET node effectively:

  • Use the class attribute to filter by software, hardware, and CPU on the ASSET node.
  • Use the type attribute to filter data at a more refined level such as software version or edition, or hardware product or model.

Class attributes

Use the class attribute with the ASSET node only to refine the query by software, hardware, or CPU, for example,

MATCH (alias:ASSET {class: 'Software'}) RETURN alias LIMIT 10

You can also use the WHERE clause to specify the class attribute.

MATCH (alias:ASSET) WHERE alias.class = 'Software' RETURN alias LIMIT 10

Attribute values for the class and type attributes are capitalized.
For example, class: 'Software', type: 'Version'

Type attributes

The type attribute is used primarily with the ASSET node.
The type attribute is used to define distinct classifications such as software Edition or Version, hardware Product or Model, or CPU Model.
Each type attribute has its own list of attributes.

The OWNER node has one type attribute only, which is Manufacturer.

It's not important to specify type in an OWNER node query because its attributes are unique and there's only one type attribute.

The following queries return the same results:
MATCH (myalias:OWNER {type: 'Manufacturer'}) RETURN myalias LIMIT 10

MATCH (myalias:OWNER) RETURN myalias LIMIT 10

You can query by using the type attribute without specifying class.

If you query by the Product type attribute and don't specify the software or hardware class attribute, you might get software and hardware results because this attribute exists for both software and hardware.

You can also query directly at the lowest-level attribute, such as product or edition but you must prove a precise value to match the attribute value in the database.

TIP

Use the WHERE clause with CONTAINS when you're not sure about the product name or you only have a partial name.

The following example matches the software product 'Enterprise Developer' because the partial name is contained in the product attribute:


MATCH (x:ASSET) WHERE x.product CONTAINS 'Enterprise Develop' RETURN x LIMIT 25

The following example matches the software product 'Enterprise Developer' as it's stored in the Technopedia database:


MATCH (x:ASSET {product: 'Enterprise Developer'}) RETURN x LIMIT 25

Using class and type attributes

To make your query more precise and avoid any ambiguity, use the class and type attributes in your MATCH statement, as showing in the following example:
MATCH (n:ASSET {class: 'Software', type: 'Product', product: 'Enterprise Developer'}) RETURN n LIMIT 25


Get a list of attributes that are under a specific type attribute by running the following query:
MATCH (alias:ASSET {class: '<Value>', 'type': '<Value>'}) RETURN alias


The following query shows hardware model attributes:
MATCH (alias:ASSET {class: 'Hardware', 'type: 'Model'}) RETURN alias

If the type attribute is unique and only applies to one class, you don't need to define the class attribute.

The following diagram shows more detail about attributes on the ASSET node that you can use:

Figure 1. Class and type attributes on the ASSET node

As you add attributes from left to right, the query becomes more specific:

Attribute values for the class and type attributes are capitalized.

The type attribute can also be used with the OWNER node to reference Manufacturer

MATCH (alias:OWNER {type: 'Manufacturer'}) RETURN alias

To get data manufacturing data for DigiPortal software, use the following query:

MATCH (alias:OWNER {type: 'Manufacturer', owner: 'DigiPortal Software'}) RETURN alias

Best practice for using TQL

Use the WHERE and CONTAINS clauses to help you find data when you're unsure about attribute values or spellings.

The following examples show how you might use the WHERE and CONTAINS clauses:

MATCH (n:ASSET {class: 'Software'}) WHERE n.owner CONTAINS 'Microsof' RETURN n.product LIMIT 25

MATCH (n:ASSET {class: 'Software'}) WHERE n.owner CONTAINS 'Informati' RETURN n.product, n.owner LIMIT 25


The following image shows results for the query example above:

Figure 2. Results from query that uses the WHERE and CONTAINS clauses



Include the Release attribute in an ASSET node query to return most of the software attributes that you most likely need.


The following query example outputs the software attributes that are shown in the following image:

MATCH (n:ASSET {type: 'Release'}) RETURN n LIMIT 1

Figure 3. Attributes returned by the Release type attribute for one product

More 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 (n:OWNER) RETURN n LIMIT 1

RESPONSE 

      {
        "results": [
            {              
                "n.legal": "Corporation",
                "n.owner": "Digeo",
                "n.symbol": "Private",
                "n.technopedia_id": "96e3a172-d3d9-4eed-bcd1-dfe4b5966c8d",
                "n.tier": 3,
                "n.type": "Manufacturer",
                "n.website": "http://www.digeo.com/",
            }
        ]
      {  
MATCH (r:ASSET {class: 'Software'}) RETURN r LIMIT 1

RESPONSE 

      {
        "results": [
            {
                "r.class": "Software",
                "r.component": "Server",
                "r.created_at": "2007-12-09T21:06:59Z",
                "r.modified_at": "2011-08-05T11:30:29Z",
                "r.owner": "01 Communique Laboratory",
                "r.product": "I'm InTouch",
                "r.technopedia_id": "ca47f890-adec-4605-b8a4-313ce30575d9",
                "r.title": "01 Communique Laboratory I'm InTouch Server",
                "r.type": "Component" 
            }
        ]
      {  
MATCH (r:ASSET {class: 'Software'}) 
WHERE r.product = "Office" OR r.product="HealthMatics" 
RETURN r 
LIMIT 2

RESPONSE

      {
    "results": [
        {
            "r.class": "Software",
            "r.component": "Client",
            "r.created_at": "2005-01-31T00:00:00Z",
            "r.family": "AutoVue",
            "r.modified_at": "2016-10-25T11:09:37Z",
            "r.owner": "Cimmetry Systems",
            "r.product": "Office",
            "r.technopedia_id": "d3ad897f-bfb5-4044-80ad-74b4c27b210f",
            "r.title": "Cimmetry Systems AutoVue Office Client",
            "r.type": "Component"
        },
        {
            "r.class": "Software",
            "r.component": "Server",
            "r.created_at": "2005-01-31T00:00:00Z",
            "r.family": "AutoVue",
            "r.modified_at": "2016-10-25T11:09:25Z",
            "r.owner": "Cimmetry Systems",
            "r.product": "Office",
            "r.technopedia_id": "601438cd-6cbd-4faf-903c-461798a51ac8",
            "r.title": "Cimmetry Systems AutoVue Office Server",
            "r.type": "Component"
        }
    ]
}
MATCH (u:ASSET)
WHERE u.release CONTAINS '23' 
RETURN u.release, u.product LIMIT 5

RESPONSE

{
    "results": [
        {
            "u.product": "Analog",
            "u.release": "Ableton Analog 1.23"
        },
        {
            "u.product": "ACDSee",
            "u.release": "ACD Systems International ACDSee 10.0.238"
        },
        {
            "u.product": "ACDSee Pro Photo Manager",
            "u.release": "ACD Systems International ACDSee Pro Photo Manager 2.0 build 238"
        },
        {
            "u.product": "ActivePython",
            "u.release": "ActiveState ActivePython 2.3.233"
        },
        {
            "u.product": "ActivePerl",
            "u.release": "ActiveState ActivePerl 5.23 Community"
        }
    ]
}
MATCH (a:ASSET)<-[:OWNS]-(o:OWNER) WHERE a.product = 'Word' and a.type = 'Release' and o.owner = 'Microsoft' 
RETURN a.product, a.release, a.version, a.edition, o.owner LIMIT 5

RESPONSE

{
    "results": [
        {
            "a.edition": null,
            "a.product": "Word",
            "a.release": "Microsoft Office Word 1.2",
            "a.version": "1.2",
            "o.owner": "Microsoft"
        },
        {
            "a.edition": null,
            "a.product": "Word",
            "a.release": "Microsoft Office Word 1.2",
            "a.version": "1.2",
            "o.owner": "Microsoft"
        },
        {
            "a.edition": null,
            "a.product": "Word",
            "a.release": "Microsoft Office Word 1.2",
            "a.version": "1.2",
            "o.owner": "Microsoft"
        },
        {
            "a.edition": null,
            "a.product": "Word",
            "a.release": "Microsoft Office Word 1.2",
            "a.version": "1.2",
            "o.owner": "Microsoft"
        },
        {
            "a.edition": null,
            "a.product": "Word",
            "a.release": "Microsoft Office Word 12.0 SP3",
            "a.version": "12.0",
            "o.owner": "Microsoft"
        }
    ]
}
curl -G -H "Authorization: Bearer b93477a9-057b-4878-a16b93477a9-057b" "https://data.technopedia.com/tql" --data-urlencode' "q=MATCH (n:ASSET {type: 'Release'}) RETURN n.release LIMIT 3

TQL Queries


Suggested Edits are limited on API Reference Pages

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