Graph Databases

Resolve resource dependencies from RDF records

BOTIE

Project expanded IRI statements into a graph. Notice that identical statements collapse and literal objects are excluded from this particular projection.
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

Project expanded IRI statements into a graph. Notice that identical statements collapse and literal objects are excluded from this particular projection.

The same identifier text occurs as a resource and as a literal.

Inspect the component calculation
Project resource triples as a graph(
  Expanded RDF triple records: Expanded statement records
)
Examples and results
Expanded statement records
[
  {
    "s": "https://perceptronlab.example/P7",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S1",
    "kind": "iri"
  },
  {
    "s": "https://perceptronlab.example/P8",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S1",
    "kind": "iri"
  },
  {
    "s": "https://perceptronlab.example/P7",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S1",
    "kind": "iri"
  },
  {
    "s": "https://perceptronlab.example/P9",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S1",
    "kind": "literal"
  },
  {
    "s": "https://perceptronlab.example/P7",
    "p": "https://perceptronlab.example/near",
    "o": "https://perceptronlab.example/S2",
    "kind": "iri"
  }
]
Required result
The nodes and directed relationships in this value.Records: https://perceptronlab.example/P7; Resource. https://perceptronlab.example/S1; Resource. https://perceptronlab.example/P8; Resource. https://perceptronlab.example/S2; Resource. Relationships: https://perceptronlab.example/P7 to https://perceptronlab.example/S1: https://perceptronlab.example/dependsOn. https://perceptronlab.example/P8 to https://perceptronlab.example/S1: https://perceptronlab.example/dependsOn. https://perceptronlab.example/P7 to https://perceptronlab.example/S2: https://perceptronlab.example/near. Full records and relationships are also listed below the diagram.https://perceptronlab.example/P7 to https://perceptronlab.example/S1: https://perceptronlab.example/dependsOnhttps://perceptronlab.example/dependsOnhttps://perceptronlab.example/dep…https://perceptronlab.example/P8 to https://perceptronlab.example/S1: https://perceptronlab.example/dependsOnhttps://perceptronlab.example/dependsOnhttps://perceptronlab.example/dep…https://perceptronlab.example/P7 to https://perceptronlab.example/S2: https://perceptronlab.example/nearhttps://perceptronlab.example/nearhttps://perceptronlab.example/nearhttps://perceptronlab.example/P7https://perceptronlab.e…ResourceResourcehttps://perceptronlab.example/S1https://perceptronlab.e…ResourceResourcehttps://perceptronlab.example/P8https://perceptronlab.e…ResourceResourcehttps://perceptronlab.example/S2https://perceptronlab.e…ResourceResource
Nodes and properties (4)
  • https://perceptronlab.example/P7 · Resource
  • https://perceptronlab.example/S1 · Resource
  • https://perceptronlab.example/P8 · Resource
  • https://perceptronlab.example/S2 · Resource
  • https://perceptronlab.example/P7 to https://perceptronlab.example/S1: https://perceptronlab.example/dependsOn
  • https://perceptronlab.example/P8 to https://perceptronlab.example/S1: https://perceptronlab.example/dependsOn
  • https://perceptronlab.example/P7 to https://perceptronlab.example/S2: https://perceptronlab.example/near
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "https://perceptronlab.example/P7",
      "kind": "Resource"
    },
    {
      "id": "https://perceptronlab.example/S1",
      "kind": "Resource"
    },
    {
      "id": "https://perceptronlab.example/P8",
      "kind": "Resource"
    },
    {
      "id": "https://perceptronlab.example/S2",
      "kind": "Resource"
    }
  ],
  "edges": [
    {
      "id": "[\"https://perceptronlab.example/P7\",\"https://perceptronlab.example/dependsOn\",\"https://perceptronlab.example/S1\"]",
      "source": "https://perceptronlab.example/P7",
      "target": "https://perceptronlab.example/S1",
      "type": "https://perceptronlab.example/dependsOn"
    },
    {
      "id": "[\"https://perceptronlab.example/P8\",\"https://perceptronlab.example/dependsOn\",\"https://perceptronlab.example/S1\"]",
      "source": "https://perceptronlab.example/P8",
      "target": "https://perceptronlab.example/S1",
      "type": "https://perceptronlab.example/dependsOn"
    },
    {
      "id": "[\"https://perceptronlab.example/P7\",\"https://perceptronlab.example/near\",\"https://perceptronlab.example/S2\"]",
      "source": "https://perceptronlab.example/P7",
      "target": "https://perceptronlab.example/S2",
      "type": "https://perceptronlab.example/near"
    }
  ]
}
Expanded statement records
[
  {
    "s": "https://perceptronlab.example/P4",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S2",
    "kind": "iri"
  },
  {
    "s": "https://perceptronlab.example/P7",
    "p": "https://perceptronlab.example/near",
    "o": "https://perceptronlab.example/S2",
    "kind": "iri"
  }
]
Required result
The nodes and directed relationships in this value.Records: https://perceptronlab.example/P4; Resource. https://perceptronlab.example/S2; Resource. https://perceptronlab.example/P7; Resource. Relationships: https://perceptronlab.example/P4 to https://perceptronlab.example/S2: https://perceptronlab.example/dependsOn. https://perceptronlab.example/P7 to https://perceptronlab.example/S2: https://perceptronlab.example/near. Full records and relationships are also listed below the diagram.https://perceptronlab.example/P4 to https://perceptronlab.example/S2: https://perceptronlab.example/dependsOnhttps://perceptronlab.example/dependsOnhttps://perceptronlab.example/dep…https://perceptronlab.example/P7 to https://perceptronlab.example/S2: https://perceptronlab.example/nearhttps://perceptronlab.example/nearhttps://perceptronlab.example/nearhttps://perceptronlab.example/P4https://perceptronlab.e…ResourceResourcehttps://perceptronlab.example/S2https://perceptronlab.e…ResourceResourcehttps://perceptronlab.example/P7https://perceptronlab.e…ResourceResource
Nodes and properties (3)
  • https://perceptronlab.example/P4 · Resource
  • https://perceptronlab.example/S2 · Resource
  • https://perceptronlab.example/P7 · Resource
  • https://perceptronlab.example/P4 to https://perceptronlab.example/S2: https://perceptronlab.example/dependsOn
  • https://perceptronlab.example/P7 to https://perceptronlab.example/S2: https://perceptronlab.example/near
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "https://perceptronlab.example/P4",
      "kind": "Resource"
    },
    {
      "id": "https://perceptronlab.example/S2",
      "kind": "Resource"
    },
    {
      "id": "https://perceptronlab.example/P7",
      "kind": "Resource"
    }
  ],
  "edges": [
    {
      "id": "[\"https://perceptronlab.example/P4\",\"https://perceptronlab.example/dependsOn\",\"https://perceptronlab.example/S2\"]",
      "source": "https://perceptronlab.example/P4",
      "target": "https://perceptronlab.example/S2",
      "type": "https://perceptronlab.example/dependsOn"
    },
    {
      "id": "[\"https://perceptronlab.example/P7\",\"https://perceptronlab.example/near\",\"https://perceptronlab.example/S2\"]",
      "source": "https://perceptronlab.example/P7",
      "target": "https://perceptronlab.example/S2",
      "type": "https://perceptronlab.example/near"
    }
  ]
}
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.

A familiar local name belongs to another vocabulary

This check uses the pieces from “Match the dependency predicate and requested resource”.

BOTIE

Find resources depending on S8 using https://perceptronlab.example/dependsOn. R2 has that resource link twice. R3 uses https://vendor.example/dependsOn, R4 uses a literal that looks like the S8 IRI, and R5 has the requested resource link. Predict the distinct subject IRIs.
Expanded statement records
[
  {
    "s": "https://perceptronlab.example/R2",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S8",
    "kind": "iri"
  },
  {
    "s": "https://perceptronlab.example/R3",
    "p": "https://vendor.example/dependsOn",
    "o": "https://perceptronlab.example/S8",
    "kind": "iri"
  },
  {
    "s": "https://perceptronlab.example/R4",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S8",
    "kind": "literal"
  },
  {
    "s": "https://perceptronlab.example/R2",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S8",
    "kind": "iri"
  },
  {
    "s": "https://perceptronlab.example/R5",
    "p": "https://perceptronlab.example/dependsOn",
    "o": "https://perceptronlab.example/S8",
    "kind": "iri"
  }
]
Requested resource IRI
https://perceptronlab.example/S8

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 two distinct inspection events need more than repeating an identical RDF triple?

Preserve entity and event identity when moving between graph data models.

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 courseWhere Did This Maintenance Claim Come From? →