Databases Reference
In-Depth Information
the year in which they were written, latest first. Using WITH , we then pipe the results to
the collect function, which produces a comma-delimited list of play titles:
START bard= node :author(lastname= 'Shakespeare' )
MATCH (bard)-[w:WROTE_PLAY]->(play)
WITH play
ORDER BY w.year DESC
RETURN collect (play.title) AS plays
Executing this query against our sample graph produces the following result:
+---------------------------------+
| plays |
+---------------------------------+
| ["The Tempest","Julius Caesar"] |
+---------------------------------+
1 row
As queries become more complex, WITH instills a sense of discipline, in large part because
it insists on separating read-only clauses from write-centric SET operations.
Common Modeling Pitfalls
Although graph modeling is a very expressive way of mastering the complexity in a
problem domain, expressivity in and of itself is no guarantee that a particular graph is
fit for purpose. In fact, there have been occasions where even those of us who work with
graphs all the time make mistakes. In this section we'll take a look at a model that went
wrong. In so doing, we'll learn how to identify problems early in the modeling effort,
and how to fix them.
Email Provenance Problem Domain
This example involves the analysis of email communications. Communication pattern
analysis is a classic graph problem. Normally, we'd interrogate the graph to discover
subject matter experts, key influencers, and the communication chains through which
information is propagated. On this occasion, however, instead of looking for positive
role models (in the form of experts), we were searching for rogues: that is, suspicious
patterns of email communication that fall foul of corporate governance—or even break
the law.
A Sensible First Iteration?
In analyzing the domain we learned about all the clever patterns that potential wrong-
doers adopt to cover their tracks: using blind-copying (BCC), using aliases—even
conducting conversations with those aliases to mimic legitimate interactions between
real business stakeholders. Based on this analysis we produced a representative graph
model that seemed to capture all the relevant entities and their activities.
Search WWH ::




Custom Search