Skip to content

A TinkerPop Story

December 12, 2011

In a time long, long right now and a place far, far within, there exists a little green gremlin named…well, Gremlin. Gremlin lives in a place known as TinkerPop. For those who think of a “place” as some terrestrial surface coating a sphere that is circling one of the many massive fiery nuclear reactors in the known universe, TinkerPop is that, yet at the same time, a wholly different type of place indeed.

The unusual aspect of TinkerPop is that every possible “thing” is related to every possible “thing” in every conceivable way possible. For instance, the delightfully unpleasant Tom loves his hate for the disgustingly adorable Jerry. Even purely conceptual things enjoy an arbitrary existence: left is to the right of east and up is both beside and within down. Conscious things can experience a tropical island bench while drinking hop cocoa in font of a log burying fire.

Gremlin realizes that a logic-less land is a canvas asking to be constrained by any being wishing to create meaning. With this notion in his mind, Gremlin decides to come to terms with the TinkerPop. The little green guy, being a machine elf, is a master engineer. Literally, Gremlin is great at making friends. He goes to work constructing Blueprints. Sparing no detail too small, Gremlin tells Blueprints which aspects of the TinkerPop he decides are “true.” Blueprints diligently saves this subgraph of the TinkerPop into his underlying database.

Graph graph = new TinkerGraph();
Vertex tom = graph.addVertex(1);
Vertex jerry = graph.addVertex(2);
graph.addEdge(3, tom, jerry, "hates");

Day in and day out, Gremlin spends his time reciting to Blueprints a story like no other, where the characters and their relationships are selectively picked from the infinity that is the TinkerPop.

Bugs Bunny is one “wascally wabbit.” Basically, Bugs is about as cool as it gets. His colleague Daffy thinks he is smarter and cooler, but really he isn’t.

Overtime, it becomes difficult for Gremlin to keep track of his ontology: “Smurfs can’t breath underwater, but Snorks can…and aren’t Smurfs Snorks?!” Gremlin decides to make a friend in Frames so that Frames can help him with his story’s existential crises. Frames is programmed with a set of axioms and a set of inferences. These suffuse a consistency over his world and crystallize a metaphysics so fundamental that his characters realize no other way but the truth that Gremlin has chosen.

public interface Cat {
  @Relation(label="enemy")
  public void addEnemy(Mouse mouse);
  @Relation(label="enemy")
  public Collection getEnemies();
}

FramesManager manager = new FramesManager(graph);
Cat tom = manager.frame(graph.getVertex(1), Cat.class);
Mouse jerry = manager.frame(graph.getVertex(2), Mouse.class);
tom.addEnemy(jerry);

One day Gremlin asks Blueprints to recite back to him the story thus far.

for(Edge edge: graph.getEdges()) {
  System.out.println(edge);
}

Blueprints, in a single moment, tells of Chilly Willy, Chilly’s North Pole home, his many “ah ee, a choo!“s, that damn Woody Woodpecker, and all the other creations in Gremlin’s story. To Gremlin’s distress, the world all at once is too much for him to bear. There is no flow, no movement, simply an iterated list of unordered facts. In a stroke of genius, he heads to his shop and fabrics Pipes. Pipes’ job is to ensure that Blueprints streams Gremlin’s story in a lazy, on demand, fashion. Through Pipes, Gremlin can experience the lives of his characters, their friendships, their passions, their ups and downs — a small drama within the TinkerPop washes through Gremlin’s being and through the minds of his characters.

Pipes, would you please fetch the names of Tom’s enemies that start with the letter ‘J’?

new GremlinPipeline(graph.getVertex(1)).out("hates").property("name").filter(new PipeFunction() {
  public Boolean compute(String name) {
    return name.startsWith("J");
  }
}

Pipes and Gremlin form a close bond. Together they craft a shorthand slang for communicating. In fact, they create various mini-languages each with their benefits and drawbacks.

g.v(1).out('hates').name.filter{it.startsWith('J')}

As Gremlin experiences his story unfold, he has a sense that perhaps there are patterns in his madness. All the facts that he has told Blueprints, via Frames, and have come to re-experience through Pipes are not random in the slightest. There exists structure and general laws. To prove his hypothesis, Gremlin goes about designing and building Furnace. Once up and running, Furnace is put to work distilling the statistical properties of Gremlin’s subset of the TinkerPop.

Who are the most central Smurfs in the Smurf’s friendship graph?
Do enemies in the graph tend to be of the same gender?
Do all economic pathways lead to Scrooge McDuck?
Why do people who like Rainbow Bright also like My Little Pony?

Saddened by the seeming barrier between himself and his creation, Gremlin wonders if the characters within his story can come to realize his role in their world. Can the objects in the virtual machine reflect upon the machine that yields their existence? As his final creation, Gremlin constructs his trusty, loyal friend Rexster. Rexster spends his nights howling into the TinkerPop, hoping for someone to hear him — for someone to realize that the world they live in is but a function of Gremlin’s selective path through the infinity that is the TinkerPop. Hopefully someone will get a reference — maybe someone will make contact…and maybe someone else will ultimately realize the TinkerPop.


http://localhost:8182/graphs/tinkergraph/vertex/1

From → TinkerPop

One Comment

Trackbacks & Pingbacks

  1. The Opinionated Guide To The YOW! Conference - Agile Bench

Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 138 other followers

%d bloggers like this: