Graph Databases
Count completed inspection identities
BOTIE
Examples, experiments and workspace controls
Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.
Try your own inputs
Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.
Context for this challenge
Seed the Asset nodes, expand HAS_INSPECTION and attach kind and status from each endpoint. Keep endpoints that are Inspection nodes with status closed.
An import can repeat a relationship without creating another inspection.
Inspect the component calculation
Keep rows passing a comparison(
Rows: Keep rows passing a comparison(
Rows: Read properties at the bound node(
Binding rows: Extend each binding by one relationship(
Binding rows: Start a binding at each identifier(
Starting IDs: Collect distinct identifiers(
Records: Keep rows passing a comparison(
Rows: Read graph nodes(
Graph: Maintenance graph
)
Comparison value: Text comparison value(
Text: Asset
)
Field to compare: kind
Comparison: =
)
Identifier field: id
)
)
Typed relationships: Choose a relationship type(
Relationships: Read graph relationships(
Graph: Maintenance graph
)
Relationship type: HAS_INSPECTION
)
When no extension matches: required
)
Graph: Maintenance graph
Node fields to read: status,kind
)
Comparison value: Text comparison value(
Text: Inspection
)
Field to compare: n_kind
Comparison: =
)
Comparison value: Text comparison value(
Text: closed
)
Field to compare: n_status
Comparison: =
)Examples and results
- Maintenance graph
Nodes and properties (6)
- P7 · Asset
- P8 · Asset
- I1 · Inspection
- status: closed
- I2 · Inspection
- status: open
- T1 · Technician
- T2 · Technician
- P7 to I1: HAS_INSPECTION
- P8 to I2: HAS_INSPECTION
- I1 to T1: CARRIED_OUT_BY
- I2 to T2: CARRIED_OUT_BY
Inspect the node and relationship records
{ "nodes": [ { "id": "P7", "kind": "Asset" }, { "id": "P8", "kind": "Asset" }, { "id": "I1", "kind": "Inspection", "status": "closed" }, { "id": "I2", "kind": "Inspection", "status": "open" }, { "id": "T1", "kind": "Technician" }, { "id": "T2", "kind": "Technician" } ], "edges": [ { "id": "h1", "source": "P7", "target": "I1", "type": "HAS_INSPECTION" }, { "id": "h2", "source": "P8", "target": "I2", "type": "HAS_INSPECTION" }, { "id": "t1", "source": "I1", "target": "T1", "type": "CARRIED_OUT_BY" }, { "id": "t2", "source": "I2", "target": "T2", "type": "CARRIED_OUT_BY" } ] }- Required result
[ { "origin": "P7", "current": "I1", "path": [ "P7", "I1" ], "edge_ids": [ "h1" ], "n_status": "closed", "n_kind": "Inspection" } ]
- Maintenance graph
Nodes and properties (6)
- P7 · Asset
- P8 · Asset
- I1 · Inspection
- status: open
- I2 · Inspection
- status: open
- T1 · Technician
- T2 · Technician
- P7 to I1: HAS_INSPECTION
- P8 to I2: HAS_INSPECTION
- I1 to T1: CARRIED_OUT_BY
- I2 to T2: CARRIED_OUT_BY
Inspect the node and relationship records
{ "nodes": [ { "id": "P7", "kind": "Asset" }, { "id": "P8", "kind": "Asset" }, { "id": "I1", "kind": "Inspection", "status": "open" }, { "id": "I2", "kind": "Inspection", "status": "open" }, { "id": "T1", "kind": "Technician" }, { "id": "T2", "kind": "Technician" } ], "edges": [ { "id": "h1", "source": "P7", "target": "I1", "type": "HAS_INSPECTION" }, { "id": "h2", "source": "P8", "target": "I2", "type": "HAS_INSPECTION" }, { "id": "t1", "source": "I1", "target": "T1", "type": "CARRIED_OUT_BY" }, { "id": "t2", "source": "I2", "target": "T2", "type": "CARRIED_OUT_BY" } ] }- Required result
[]
- Maintenance graph
Nodes and properties (2)
- A · Asset
- T · Technician
- status: closed
- A to T: HAS_INSPECTION
Inspect the node and relationship records
{ "nodes": [ { "id": "A", "kind": "Asset" }, { "id": "T", "kind": "Technician", "status": "closed" } ], "edges": [ { "id": "bad", "source": "A", "target": "T", "type": "HAS_INSPECTION" } ] }- Required result
[]
Try a fresh construction
This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.
Stuck? Inspect a worked construction
The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.
Assumptions and test precision
These components operate on the supplied records in your browser. They do not run a graph database or interpret Cypher. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.
Your last tested pieces can start the full construction. An existing draft there keeps its own pieces.
Two completed inspections share a duplicated link
This check uses the pieces from “Count the distinct pair at the right grain”.
BOTIE
- Maintenance graph
Nodes and properties (7)
- R2 · Asset
- R1 · Asset
- R0 · Asset
- I6 · Inspection
- status: closed
- I7 · Inspection
- status: closed
- I8 · Inspection
- status: open
- T9 · Technician
- status: closed
- R2 to I6: HAS_INSPECTION
- R2 to I6: HAS_INSPECTION
- R2 to I7: HAS_INSPECTION
- R1 to I8: HAS_INSPECTION
- R1 to T9: HAS_INSPECTION
Inspect the node and relationship records
{ "nodes": [ { "id": "R2", "kind": "Asset" }, { "id": "R1", "kind": "Asset" }, { "id": "R0", "kind": "Asset" }, { "id": "I6", "kind": "Inspection", "status": "closed" }, { "id": "I7", "kind": "Inspection", "status": "closed" }, { "id": "I8", "kind": "Inspection", "status": "open" }, { "id": "T9", "kind": "Technician", "status": "closed" } ], "edges": [ { "id": "a", "source": "R2", "target": "I6", "type": "HAS_INSPECTION" }, { "id": "copy", "source": "R2", "target": "I6", "type": "HAS_INSPECTION" }, { "id": "b", "source": "R2", "target": "I7", "type": "HAS_INSPECTION" }, { "id": "c", "source": "R1", "target": "I8", "type": "HAS_INSPECTION" }, { "id": "mistyped", "source": "R1", "target": "T9", "type": "HAS_INSPECTION" } ] }
Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.
Build a construction in the workspace above first. This case will test those pieces.
Why would deduplicating only inspection IDs before grouping lose information about shared inspections?
Choose the complete identity tuple that preserves the intended group relationship.
These components operate on the supplied records in your browser. They do not run a graph database or interpret Cypher.
Work through the Python challenges →