Databases Reference
In-Depth Information
Caesar' ) and The Tempest ( title: 'The Tempest' ) via relationships labeled
WROTE_PLAY .
Reading this subgraph left-to-right, following the direction of the relationship arrows,
conveys the fact that William Shakespeare wrote Julius Caesar and The Tempest . If we're
interested in provenance, each WROTE_PLAY relationship has a date property, which tells
us that Julius Caesar was written in 1599 and The Tempest in 1610. It's a trivial matter
to see how we could add the rest of Shakespeare's works—the plays and the poems—
into the graph simply by adding more nodes to represent each work, and joining them
to the Shakespeare node via WROTE_PLAY and WROTE_POEM relationships.
By tracing the WROTE_PLAY relationship arrows with our finger, we're
effectively doing the kind of work that a graph database performs, albeit
at human speed rather than computer speed. As we'll see later, this sim‐
ple traversal operation is the building block for arbitrarily sophisticated
graph queries.
Turning next to the theatrical domain, you can see that we've added some information
about the Royal Shakespeare Company (often known simply as the RSC ) in the form of
a node with the key company and value RSC . The theatrical domain is, unsurprisingly,
connected to the literary domain: in our graph, this is reflected by the fact that the RSC
has PRODUCED versions of Julius Caesar and The Tempest ; these theatrical productions
are in turn connected to their literary source, the plays in the literary domain using
PRODUCTION_OF relationships. The graph also captures details of specific performances:
the RSC's production of Julius Caesar , for example, was performed on 29 July 2012 as
part of the RSC's summer touring season. If we're interested in the performance venue,
we simply follow the outgoing VENUE relationship from the performance node to find
that the play was performed at the Theatre Royal.
The graph also allows us to capture reviews of specific performances. In our sample
graph we've included just one review, for the 29 July performance, written by the user
Billy . We can see this in the interplay of the performance, rating, and user nodes. In
this case we have a node representing Billy ( name: 'Billy' ) whose outgoing WROTE_RE
VIEW relationship connects to a node representing his review. The review node contains
a numeric rating property and a free-text review property. The review is linked to a
specific performance through an outgoing REVIEW_OF relationship. To scale this up to
many users, many reviews, and many performances, we simply add more nodes and
more identically named relationships to the graph.
The third domain, that of geospatial data, comprises a simple hierarchical tree of places.
This geospatial domain is connected to the other two domains at several points in the
graph. The town of Stratford upon Avon (with property name: 'Stratford upon
Search WWH ::




Custom Search