Graph Databases

Check approval against the graph snapshot

BOTIE

Keep only requests whose approved field is boolean true. Inspect which records remain before checking their snapshot revisions.
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

Keep only requests whose approved field is boolean true. Inspect which records remain before checking their snapshot revisions.

An approved request can become stale before it reaches the executor.

Inspect the component calculation
Keep explicitly approved requests(
  Requests: Proposed requests and approvals
)
Examples and results
Proposed requests and approvals
[
  {
    "id": "P7",
    "expected_revision": 2,
    "approved": true
  },
  {
    "id": "P8",
    "expected_revision": 3,
    "approved": true
  },
  {
    "id": "P7",
    "expected_revision": 2,
    "approved": false
  }
]
Required result
[
  {
    "id": "P7",
    "expected_revision": 2,
    "approved": true
  },
  {
    "id": "P8",
    "expected_revision": 3,
    "approved": true
  }
]
Proposed requests and approvals
[
  {
    "id": "P8",
    "expected_revision": 4,
    "approved": true
  }
]
Required result
[
  {
    "id": "P8",
    "expected_revision": 4,
    "approved": true
  }
]
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.

Revision zero is valid but a numeric-looking string is not

This check uses the pieces from “Compare approved requests with the known snapshot”.

BOTIE

W is at revision three, X at zero, Y at six and Z at eight. The requests include approvals for W and X, a repeated X request, a string revision for Y, a stale revision for Z and a missing node. Predict the eligible target IDs without treating this preflight as a committed update.
Current node snapshot
The nodes and directed relationships in this value.Records: W; revision: 3. X; revision: 0. Y; revision: 6. Z; revision: 8. Relationships: none. Full records and relationships are also listed below the diagram.WWrevision: 3revision: 3XXrevision: 0revision: 0YYrevision: 6revision: 6ZZrevision: 8revision: 8
Nodes and properties (4)
  • W
    • revision: 3
  • X
    • revision: 0
  • Y
    • revision: 6
  • Z
    • revision: 8
  • No relationships in this result.
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "W",
      "revision": 3
    },
    {
      "id": "X",
      "revision": 0
    },
    {
      "id": "Y",
      "revision": 6
    },
    {
      "id": "Z",
      "revision": 8
    }
  ],
  "edges": []
}
Proposed requests and approvals
[
  {
    "id": "X",
    "expected_revision": 0,
    "approved": true
  },
  {
    "id": "Y",
    "expected_revision": "6",
    "approved": true
  },
  {
    "id": "Z",
    "expected_revision": 7,
    "approved": true
  },
  {
    "id": "missing",
    "expected_revision": 0,
    "approved": true
  },
  {
    "id": "W",
    "expected_revision": 3,
    "approved": true
  },
  {
    "id": "X",
    "expected_revision": 0,
    "approved": true
  }
]

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.

What can change between this snapshot check and a later write, and why is sending an email inside a retryable callback dangerous?

Treat approval, concurrency control and external-effect delivery as separate parts of the operation.

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 courseA Replayed Import Must Not Create Another Relationship →
← Which Rules Must Every Asset Write Preserve?