Graph Databases

Follow the bound inspection to its technician

BOTIE

Start one binding at the requested asset and extend it through HAS_INSPECTION. Inspect origin, current and path in the resulting row.
Ready to test
0 passed · 0 failed · 2 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

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.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Start one binding at the requested asset and extend it through HAS_INSPECTION. Inspect origin, current and path in the resulting row.

A second pump’s technician must not enter the first pump’s result.

Inspect the component calculation
Extend each binding by one relationship(
  Binding rows: Start one pattern binding(
    Starting ID: Requested asset
  )
  Typed relationships: Choose a relationship type(
    Relationships: Read graph relationships(
      Graph: Asset, inspection and technician graph
    )
    Relationship type: HAS_INSPECTION
  )
  When no extension matches: required
)
Examples and results
Requested asset
P7
Asset, inspection and technician graph
The nodes and directed relationships in this value.Records: P7; Asset. P8; Asset. I1; Inspection; status: closed. I2; Inspection; status: open. T1; Technician. T2; Technician. Relationships: P7 to I1: HAS_INSPECTION. P8 to I2: HAS_INSPECTION. I1 to T1: CARRIED_OUT_BY. I2 to T2: CARRIED_OUT_BY. Full records and relationships are also listed below the diagram.P7 to I1: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONP8 to I2: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONI1 to T1: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYI2 to T2: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYP7P7AssetAssetP8P8AssetAssetI1I1InspectionInspectionstatus: closedstatus: closedI2I2InspectionInspectionstatus: openstatus: openT1T1TechnicianTechnicianT2T2TechnicianTechnician
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"
    ]
  }
]
Requested asset
P7
Asset, inspection and technician graph
The nodes and directed relationships in this value.Records: P7; Asset. P8; Asset. I1; Inspection; status: closed. I2; Inspection; status: open. T1; Technician. T2; Technician. Relationships: P7 to I1: HAS_INSPECTION. P8 to I2: HAS_INSPECTION. I2 to T2: CARRIED_OUT_BY. Full records and relationships are also listed below the diagram.P7 to I1: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONP8 to I2: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONI2 to T2: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYP7P7AssetAssetP8P8AssetAssetI1I1InspectionInspectionstatus: closedstatus: closedI2I2InspectionInspectionstatus: openstatus: openT1T1TechnicianTechnicianT2T2TechnicianTechnician
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
  • 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": "t2",
      "source": "I2",
      "target": "T2",
      "type": "CARRIED_OUT_BY"
    }
  ]
}
Required result
[
  {
    "origin": "P7",
    "current": "I1",
    "path": [
      "P7",
      "I1"
    ],
    "edge_ids": [
      "h1"
    ]
  }
]
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.

One technician completed two inspections

This check uses the pieces from “Continue from that inspection to its technician”.

BOTIE

R4 has three inspections. Two were performed by T3 and one by T4. R5 has a separate inspection by T8, while a direct R4-to-T9 CARRIED_OUT_BY edge skips the inspection. Predict the technicians reached by the required two-step pattern from R4.
Asset, inspection and technician graph
The nodes and directed relationships in this value.Records: R4; Asset. R5; Asset. I7; Inspection. I8; Inspection. I9; Inspection. I10; Inspection. T3; Technician. T4; Technician. T8; Technician. T9; Technician. Relationships: R4 to I7: HAS_INSPECTION. R4 to I8: HAS_INSPECTION. R4 to I9: HAS_INSPECTION. R5 to I10: HAS_INSPECTION. I7 to T3: CARRIED_OUT_BY. I8 to T3: CARRIED_OUT_BY. I9 to T4: CARRIED_OUT_BY. I10 to T8: CARRIED_OUT_BY. R4 to T9: CARRIED_OUT_BY. Full records and relationships are also listed below the diagram.R4 to I7: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR4 to I8: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR4 to I9: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR5 to I10: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONI7 to T3: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYI8 to T3: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYI9 to T4: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYI10 to T8: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYR4 to T9: CARRIED_OUT_BYCARRIED_OUT_BYCARRIED_OUT_BYR4R4AssetAssetR5R5AssetAssetI7I7InspectionInspectionI8I8InspectionInspectionI9I9InspectionInspectionI10I10InspectionInspectionT3T3TechnicianTechnicianT4T4TechnicianTechnicianT8T8TechnicianTechnicianT9T9TechnicianTechnician
Nodes and properties (10)
  • R4 · Asset
  • R5 · Asset
  • I7 · Inspection
  • I8 · Inspection
  • I9 · Inspection
  • I10 · Inspection
  • T3 · Technician
  • T4 · Technician
  • T8 · Technician
  • T9 · Technician
  • R4 to I7: HAS_INSPECTION
  • R4 to I8: HAS_INSPECTION
  • R4 to I9: HAS_INSPECTION
  • R5 to I10: HAS_INSPECTION
  • I7 to T3: CARRIED_OUT_BY
  • I8 to T3: CARRIED_OUT_BY
  • I9 to T4: CARRIED_OUT_BY
  • I10 to T8: CARRIED_OUT_BY
  • R4 to T9: CARRIED_OUT_BY
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "R4",
      "kind": "Asset"
    },
    {
      "id": "R5",
      "kind": "Asset"
    },
    {
      "id": "I7",
      "kind": "Inspection"
    },
    {
      "id": "I8",
      "kind": "Inspection"
    },
    {
      "id": "I9",
      "kind": "Inspection"
    },
    {
      "id": "I10",
      "kind": "Inspection"
    },
    {
      "id": "T3",
      "kind": "Technician"
    },
    {
      "id": "T4",
      "kind": "Technician"
    },
    {
      "id": "T8",
      "kind": "Technician"
    },
    {
      "id": "T9",
      "kind": "Technician"
    }
  ],
  "edges": [
    {
      "id": "h7",
      "source": "R4",
      "target": "I7",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "h8",
      "source": "R4",
      "target": "I8",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "h9",
      "source": "R4",
      "target": "I9",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "h10",
      "source": "R5",
      "target": "I10",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "t7",
      "source": "I7",
      "target": "T3",
      "type": "CARRIED_OUT_BY"
    },
    {
      "id": "t8",
      "source": "I8",
      "target": "T3",
      "type": "CARRIED_OUT_BY"
    },
    {
      "id": "t9",
      "source": "I9",
      "target": "T4",
      "type": "CARRIED_OUT_BY"
    },
    {
      "id": "t10",
      "source": "I10",
      "target": "T8",
      "type": "CARRIED_OUT_BY"
    },
    {
      "id": "shortcut",
      "source": "R4",
      "target": "T9",
      "type": "CARRIED_OUT_BY"
    }
  ]
}
Requested asset
R4

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.

Which intermediate binding would you inspect if an unrelated technician appeared?

Preserve the connecting variable instead of independently collecting each kind of node.

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 →
Continue the courseHow Many Inspections Were Actually Completed? →
← Are These Two Pumps Actually the Same Pump?