CMSI 486: Welcome to Week 10

This Week's Class Agenda

What's Going On This Week

  1. Project SCRUMS
  2. Introduction to Graph Databases
  3. Introduction to Neo4J
  4. Some interesting comparisons

Introduction to Graph Databases

Just what *IS* a graph database?

BIG DATA… … just keeps getting bigger.
Year by year, more and more data is logged into databases for all kinds of reasons. Businesses have come to rely on applications that can interpret data, and make connections between both related and unrelated data items, to improve the profit margins and sales, and to cut down on the overhead of having people do the extensive analysis of the data. Thus, those applications must be able to accommodate HUGE amounts of data, and also must be able to detect patterns, quickly provide relevent facts [both independent facts and connections], and output information that can be used to improve business value.

Although the relational model for database engines has been the gold standard for many years, its limits are now being reached, as we've seen on previous pages during the course of the semester. It's ironic, but relational databases are actually quite poor at handling actual relationships between data points. The table model and inflexibility of pre-defined schemas mean it is difficult to add new connections between data or to make different kinds of connections within the database.

So, graph databases to the rescue! But what exactly *IS* one of these blasted things?

As we saw two weeks ago in the NoSQL discussion, graph databases use the concept of a computer science graph to store data and relationships. Each data item is a node, and nodes are connected by edges. Both nodes and edges can have attributes associated with them. The model we will use, Neo4j, uses a very specific type of structure known as the labeled property graph, which is one of the most generic and versatile graph models. It provides four different building blocks for structuring data:

  1. NODES are used to store entity information. like books, cars, students, buildings, and so on. This is the basis of where the actual data items are stored.
  2. RELATIONSHIPS or edges are used to explicitly connect the nodes to one another and provide a way to structure the nodes. You can think of edges as sort of a pre-defined and pre-executed join operation, but one that is set up for several possible levels of granularity. For example, since edges always have a type, a direction, a start node, and an end node, they can be self-referencing to provide easy ways of storing relationships like a person is a daughter and a mother and an aunt and a sister. Such things are much more difficult in the relational model.
  3. PROPERTIES is the term that is applied to what we previously know as attributes. They are stored as name/value pairs, sort of like we've seen in the document store databases like our old friend mondo. However, since edges [relationships] can have properties, too, this opens up a whole new class of storage, which can be used to further qualify the relationship between nodes, and which can be used to help with queries and graph traversals.
  4. Finally, LABELS are a way to create subgraphs, which can be a big help when trying to index the graph and to provide meta-information about the nodes so that there doesn't need to be a node containing definitions for nodes or type properties.
get pic from learning book p. 74
What are some use cases for them?
[Excerpted from The top 5 use cases of graph databases from neo4j.com]
Why are graph databases so cool?
blog info
Why are graph databases not so cool?

It is an interesting phenomenon that typing graph databases suck into your favorite search engine does NOT return any links that actually address that situation. What does this mean? You can find dissenting opinions on just about ANYTHING by typing the appropriate phrase into google… so what's up with that?

Why are graph databases not more popular than they are?

One reason is the fact that most users still have a relational mindset which means they are used to the RDBMS model and are slow to change to something that is new and requires deeper understanding and training. In addition, many management chains are hesitant to invest in a technology with which they are not familiar, so until these stakeholders understand the graph database model, there will be little investment in graph DBMS applications. A second reason is that there is not a completely standard language for programming them, like there is SQL for the relational model. this means that implementers must learn to use the appropriate API for whatever graph database they have decided to use. A third reason is that humans are largely linear in their thinking, and adapt most readily to the idea of a relational model because it is easier to understand than a graphical one. The linear relationships seem more natural, so it is foreign to people to have to think in terms of real relationships, a.k.a. graphs. Yet another reason is the idea that a single database is one size fits all, which [although it is rarely the case in the real world any longer] makes implementers more reticent to include graph databases alongside the RDBMS in a system. Finally, there is the problem of visual tools, which oracle and other have implemented to help DBA's with DBMS management tasks. Again, there are few standard tools for graph databases for viewing data in a graphical manner.

Introduction to Neo4j

Neo shares a number of core concepts with relational engines. For one thing, it is performs all the four main operations of any database, i.e., CRUD. Second, Neo is optimised for use with On Line Transaction Processing [OLTP] engines, so it is automatically optimized for transaction processing [and concurrency, of course]. Thus, it upholds the principles of transactional integrity and operational availability.

Neo is different from relational databases [which indreasingly becomes a misnomer as we discover what real relational databases are all about] in that the relationships are the primary focus, not the data items and their attributes, so the number of joins and foreign keys [and associated complexity] drops to zero. This focus also allows modeling that more closely matches the problem domain, since it is more life-like in its approach to the abstractions/models in most all domains.

What is Cypher?

Cypher is the query language that Neo4j uses. Cypher is a declarative language that looks at what to query instead of how to query. It is designed to make things easy for the user and the DBA, so it is relatively human-friendly. This helps users come up to speed quickly, and also facilitates spending less time building and optimizing the queries, which in SQL can occupy a significant amount of development time.

Here is a link to the Neo4j Cypher quick reference card so we can take a look at the language.

Some interesting comparisons

What other graph databases exist?
What is the difference – isn't a graph database a graph database?

Let's go take a look

SCRUM: Project teams

  1. Arteaga, Peters, & West
  2. Bahar & Garcia
  3. Bennett & Mikol
  4. Boyac, Li, & Lopez
  5. Braekman, Persily, & Wroblewski
  6. Crowther, Rajavasireddy, & Simmons
  7. Derham & Ochsner
  8. Filler & Zafiris
  9. Jay & Nguyen & Prochnow
  10. Kern & Lizarda & Moini
  11. Martin
  12. Flora & Namba & Santander
  13. Nguyen & Ruiz & Tollive
  14. Patterson & Richardson
  15. Raymundo & Swaminarayan
  16. Kang & Patterson
  17. Wiggins