# Query across relationships

AI agent getting started? Read [Agents: start here](https://docs.openeng.io/agents/start-here.md) first.

Choose the connected records and calculations your task needs.

Source: https://docs.openeng.io/guides/graph-queries/

Queries answer questions across your engineering records. Find requirements, follow their verification relationships, or total the recorded mass of parts in a system.

## Choose an answer

| Question | Operation | Result |
| --- | --- | --- |
| Which records match these properties? | `queryObjects` | A paged object list |
| What connects to this object? | `queryGraph` | Objects and their relationships |
| What values or totals lie along this path? | `queryRows` | Selected fields or grouped measures |
| How are these two objects connected? | `findPaths` | Shortest relationship paths |
| What is the mean of a numeric property? | `aggregateObjects` | Mean and count of non-null values |

## Start from the right records

Choose the branch and name the projects the query should search. A selector's project does not by itself limit an object query to that project. Filters narrow the starting records; relationship steps choose where to go next.

An engineering identifier such as `OCGT-REQ-001` is a property, not the platform's object ID. Query the identifier first and use the returned object ID in later reads.

## Follow a requirement to its verification

In the example project, find `OCGT-REQ-001`, then follow incoming `verifies` relationships. The result should include `OCGT-VER-001`. The [worked CLI examples](https://docs.openeng.io/developers/query-examples.md) carry this read through lists, graphs and shortest paths.

## Calculate and combine

Group parts by Make or Buy and total their recorded mass. Use union, intersection or difference to combine two object selections. For quantities along relationships, use a weighted sum with a model that declares those quantities on the relationships.

A part's mass total is different from a BOM usage total. The example project's BOM quantities are properties of BOM-line objects, so they cannot be used as relationship weights.

## Check what the answer covers

Permissions and traversal limits affect the result. Follow continuation tokens where supported, and inspect the answer's bounded state. Hidden relationship counts do not grant access to the connected objects' properties.

Use [Query limits](https://docs.openeng.io/lookups/query-limits.md) when a result is incomplete, and [Show values from related objects](https://docs.openeng.io/configure/calculations.md) to put calculations in a view.
