Graph Databases

Preserve assets with no qualifying inspection

A newly registered pump has no relationships

The required-match report hid P8, which has no completed inspection. Botie needs the asset register to remain the population even when a match is absent.

BOTIE

P7 has one closed inspection, P8 has only an open one, and P9 has no edges. Which count should P9 receive?
The inputs we are comparing

Maintenance graph

P8 has only open work

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"
    }
  ]
}

An isolated P9 enters the registry

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. P9; Asset. 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: openT1T1TechnicianTechnicianT2T2TechnicianTechnicianP9P9AssetAsset
Nodes and properties (7)
  • P7 · Asset
  • P8 · Asset
  • I1 · Inspection
    • status: closed
  • I2 · Inspection
    • status: open
  • T1 · Technician
  • T2 · Technician
  • P9 · Asset
  • 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"
    },
    {
      "id": "P9",
      "kind": "Asset"
    }
  ],
  "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"
    }
  ]
}
Result for p8 has only open work
[
  {
    "origin": "P7",
    "n": 1
  },
  {
    "origin": "P8",
    "n": 0
  }
]

For a list use brackets, such as [2, 4]. For a matrix put each row in brackets. Text answers can stay as text.

A shared inspection counts within each asset

This check uses the pieces from “Preserve an unmatched asset binding”.

BOTIE

R1 and R2 both link to closed inspection I4. R1's link is duplicated. R3 has only an open inspection and a Technician marked closed. Predict a count for every registered asset, keeping each asset's own inspection set.
Maintenance graph
The nodes and directed relationships in this value.Records: R3; Asset. R2; Asset. R1; Asset. I4; Inspection; status: closed. I5; Inspection; status: open. T4; Technician; status: closed. Relationships: R1 to I4: HAS_INSPECTION. R2 to I4: HAS_INSPECTION. R1 to I4: HAS_INSPECTION. R3 to I5: HAS_INSPECTION. R3 to T4: HAS_INSPECTION. Full records and relationships are also listed below the diagram.R1 to I4: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR2 to I4: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR1 to I4: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR3 to I5: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR3 to T4: HAS_INSPECTIONHAS_INSPECTIONHAS_INSPECTIONR3R3AssetAssetR2R2AssetAssetR1R1AssetAssetI4I4InspectionInspectionstatus: closedstatus: closedI5I5InspectionInspectionstatus: openstatus: openT4T4TechnicianTechnicianstatus: closedstatus: closed
Nodes and properties (6)
  • R3 · Asset
  • R2 · Asset
  • R1 · Asset
  • I4 · Inspection
    • status: closed
  • I5 · Inspection
    • status: open
  • T4 · Technician
    • status: closed
  • R1 to I4: HAS_INSPECTION
  • R2 to I4: HAS_INSPECTION
  • R1 to I4: HAS_INSPECTION
  • R3 to I5: HAS_INSPECTION
  • R3 to T4: HAS_INSPECTION
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "R3",
      "kind": "Asset"
    },
    {
      "id": "R2",
      "kind": "Asset"
    },
    {
      "id": "R1",
      "kind": "Asset"
    },
    {
      "id": "I4",
      "kind": "Inspection",
      "status": "closed"
    },
    {
      "id": "I5",
      "kind": "Inspection",
      "status": "open"
    },
    {
      "id": "T4",
      "kind": "Technician",
      "status": "closed"
    }
  ],
  "edges": [
    {
      "id": "a",
      "source": "R1",
      "target": "I4",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "b",
      "source": "R2",
      "target": "I4",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "copy",
      "source": "R1",
      "target": "I4",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "open",
      "source": "R3",
      "target": "I5",
      "type": "HAS_INSPECTION"
    },
    {
      "id": "bad-kind",
      "source": "R3",
      "target": "T4",
      "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 counting every optional binding row give a missing inspection a count of one?

A placeholder preserves the starting record; it is not an observed related entity.

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 courseFollow a Dependency Without Following It Forever →