This is an old revision of the document!
Example Queries
Query by ID Number
The following query gets the ID number and name of the ARDI asset with the ID '44'.
query {
asset(id: 44) {
id
name
}
}
Query by Name/ERN/Code
The following query gets the ID number and name of the ARDI asset with the name, equipment reference number or code 'AR925'.
query {
asset(name: "AR925") {
id
name
}
}
Query by Type
The following query gets a list of all pumps in the system.
query {
pump {
id
name
}
}
Get a List of Available Properties
To get a list of the properties available on an asset (or assets), use the properties value.
query {
asset(name: "AR925") {
id
name
properties
}
}
Get a List of Directly Connected Items
To get a list of the items inside an item (meaning assets under the given asset via the Location relationship), you can use the following…
query {
asset(name: "AR925") {
id
name
inside {
id
name
temperature
}
}
}
Note that you can have a different set of attributes on the item inside.
Get a List of All Connected Items
To get a list all of the items down or upstream from an asset (in this example, the power relationship) you can use the following…
<code> query {
asset(name: "AR925") {
id
name
allPoweredBy {
id
name
temperature
}
}
}
In this case poweredBy lists the directly connected assets, and allPoweredBy lists all of the indirectly connected assets..
Get a Nested List of All Connected Items
The above query runs very quickly, but while the results include every down-stream item, the details of the connections between them are lost.
If you're trying to keep some information explaining how the various parts are connected, you can use a trick we've added.
If you ask for related items but do not include any query details (for example, you don't name the individual columns you want returned), it will use the details of the parent query again. This lets you make a 'loop' that will run through your relationships and hierarchies.
<code> query {
asset(name: "AR925") {
id
name
poweredBy
}
}