REPL Browsing

We launch the Deno read-eval-print-loop with a graph of interest loaded and ready to be queried. deno

export site="" export assets="$site/assets/pages/mock-graph-data" export graph="$assets/graphs/graph.json" deno repl --eval " import {Graph} from '$assets/graph.js'; let g = await Graph.fetch('$graph');"

Copy-paste these commands into the Terminal. Deno will start up with g set to our familiar mock data graph [⇒ Mock Graph Data]. We offer some examples of things to try next.

> g.size()

> g.tally()

> g.n('Project').o().t().props()

This last query deserves some explanation. From g we find the Project nodes, g.n('Project'). From here we follow the Manager relation, the only way out, and then the Employees that are the only place those relations go to.

Thus we find all Employees that Manage Projects, the project managers.

strict digraph { rankdir=TB node [shape=box style=filled fillcolor=palegreen] Employee -> Employee [label=" Manager" penwidth=3] Project -> Employee [label=Manager penwidth=3] Service -> Project [label=Owner] Service -> Employee [label=Team] Service -> Service [label=Flow] Service -> Statistic [label=Traffic]}

Deno repl remembers each result. We can recall an expression with up-arrow to be run over and over.

Again we start with the Projects.

> g.n('Project')

We find the project managers.

> _.o().t()

Then up-arrow for the project manager's managers.

> _.o().t()

Then over and over until we get to the big boss.

> _.o().t()