100% found this document useful (2 votes)
21 views

Graph Databases Ian Robinson download

The document discusses the significance of graph databases in managing complex relationships within highly-connected data, emphasizing their role in providing insights and competitive advantages for businesses. It highlights the evolution of graph technology from proprietary systems to accessible general-purpose databases, enabling mainstream users to leverage connected data effectively. The text also touches on the historical context of graph theory and its recent applications in various fields such as social networking and recommendations.

Uploaded by

ayaezenoni98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
21 views

Graph Databases Ian Robinson download

The document discusses the significance of graph databases in managing complex relationships within highly-connected data, emphasizing their role in providing insights and competitive advantages for businesses. It highlights the evolution of graph technology from proprietary systems to accessible general-purpose databases, enabling mainstream users to leverage connected data effectively. The text also touches on the historical context of graph theory and its recent applications in various fields such as social networking and recommendations.

Uploaded by

ayaezenoni98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Graph Databases Ian Robinson pdf download

https://ebookname.com/product/graph-databases-ian-robinson/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Genomes Browsers and Databases Data Mining Tools for


Integrated Genomic Databases 1st Edition Peter
Schattner

https://ebookname.com/product/genomes-browsers-and-databases-
data-mining-tools-for-integrated-genomic-databases-1st-edition-
peter-schattner/

Graph Algorithms 2nd Edition Shimon Even

https://ebookname.com/product/graph-algorithms-2nd-edition-
shimon-even-2/

Graph Algorithms 2nd Edition Shimon Even

https://ebookname.com/product/graph-algorithms-2nd-edition-
shimon-even/

British History for Dummies 2nd Edition Sean Lang

https://ebookname.com/product/british-history-for-dummies-2nd-
edition-sean-lang/
The Neurocognition of Language 1st Edition Colin M.
Brown

https://ebookname.com/product/the-neurocognition-of-language-1st-
edition-colin-m-brown/

Social problems 2003rd Edition Kurt Finsterbusch

https://ebookname.com/product/social-problems-2003rd-edition-
kurt-finsterbusch/

The Tyranny of Experts Economists Dictators and the


Forgotten Rights of the Poor 1st Edition William
Easterly

https://ebookname.com/product/the-tyranny-of-experts-economists-
dictators-and-the-forgotten-rights-of-the-poor-1st-edition-
william-easterly/

The Status and Appraisal of Classic Texts Conal Condren

https://ebookname.com/product/the-status-and-appraisal-of-
classic-texts-conal-condren/

Lipid domains 1st Edition Kenworthy

https://ebookname.com/product/lipid-domains-1st-edition-
kenworthy/
Essentials of Sports Law Fourth Edition Glenn M. Wong

https://ebookname.com/product/essentials-of-sports-law-fourth-
edition-glenn-m-wong/
Graph Databases

Ian Robinson, Jim Webber, and Emil Eifrem


Graph Databases
by Ian Robinson, Jim Webber, and Emil Eifrem
Copyright © 2013 Neo Technology, Inc.. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or [email protected].
Editors: Mike Loukides and Nathan Jepson Indexer: FIX ME!
Production Editor: Kara Ebrahim Cover Designer: Karen Montgomery
Copyeditor: FIX ME! Interior Designer: David Futato
Proofreader: FIX ME! Illustrator: Robert Romano

June 2013: First Edition

Revision History for the First Edition:


2013-04-11: Early release revision 1

See http://oreilly.com/catalog/errata.csp?isbn=9781449356262 for release details.

Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. !!FILL THIS IN!! and related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.

ISBN: 978-1-449-35626-2
[?]
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
About This Book 2
What is a Graph? 2
A High Level View of the Graph Space 5
Graph Databases 6
Graph Compute Engines 8
The Power of Graph Databases 10
Performance 10
Flexibility 10
Agility 11
Summary 11

2. Options for Storing Connected Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13


Relational Databases Lack Relationships 13
NOSQL Databases Also Lack Relationships 16
Graph Databases Embrace Relationships 19
Summary 23

3. Data Modeling with Graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25


Models and Goals 25
The Property Graph Model 26
Querying Graphs: An Introduction to Cypher 27
Cypher Philosophy 27
START 29
MATCH 29
RETURN 30
Other Cypher clauses 30

iii
A Comparison of Relational and Graph Modeling 30
Relational Modeling in a Systems Management Domain 31
Graph Modeling in a Systems Management Domain 34
Testing the Model 36
Cross-Domain Models 37
Creating the Shakespeare Graph 40
Beginning a Query 42
Declaring Information Patterns to Find 42
Constraining Matches 44
Processing Results 45
Query Chaining 46
Common Modeling Pitfalls 46
Email Provenance Problem Domain 47
A Sensible First Iteration? 47
Second Time’s the Charm 49
Evolving the Domain 51
Avoiding Anti-Patterns 54
Summary 55

4. Building a Graph Database Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57


Data Modeling 57
Describe the Model in Terms of Your Application’s Needs 57
Nodes for Things, Relationships for Structure 59
Fine-Grained Versus Generic Relationships 59
Model Facts as Nodes 60
Represent Complex Value Types as Nodes 64
Time 64
Iterative and Incremental Development 67
Application Architecture 68
Embedded Versus Server 68
Clustering 73
Load Balancing 74
Testing 76
Test-Driven Data Model Development 76
Performance Testing 82
Capacity Planning 86
Optimization Criteria 87
Performance 87
Redundancy 90
Load 90

5. Graphs in the Real World. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

iv | Table of Contents
Why Organizations Choose Graph Databases 93
Common Use Cases 94
Social 94
Recommendations 95
Geo 96
Master Data Management 96
Network and Data Center Management 97
Authorization and Access Control (Communications) 98
Real-World Examples 99
Social Recommendations (Professional Social Network) 99
Authorization and Access Control 107
Geo (Logistics) 113

6. Graph Database Internals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125


Native Graph Processing 125
Native Graph Storage 128
Programmatic APIs 135
Kernel API 136
Core (or “Beans”) API 136
Traversal API 138
Non-Functional Characteristics 139
Transactions 140
Recoverability 141
Availability 142
Scale 144
Summary 147

7. Predictive Analysis with Graph Theory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149


Depth- and Breadth-First Search 149
Path-Finding with Dijkstra’s Algorithm 150
The A* Algorithm 157
Graph Theory and Predictive Modeling 158
Triadic Closures 159
Structural Balance 160
Local Bridges 163
Summary 165

A. NOSQL Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

Table of Contents | v
Preface

Conventions Used in This Book


The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements
such as variable or function names, databases, data types, environment variables,
statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.

This icon signifies a tip, suggestion, or general note.

This icon indicates a warning or caution.

Using Code Examples


This book is here to help you get your job done. In general, if this book includes code
examples, you may use the code in this book in your programs and documentation. You

vii
do not need to contact us for permission unless you’re reproducing a significant portion
of the code. For example, writing a program that uses several chunks of code from this
book does not require permission. Selling or distributing a CD-ROM of examples from
O’Reilly books does require permission. Answering a question by citing this book and
quoting example code does not require permission. Incorporating a significant amount
of example code from this book into your product’s documentation does require per‐
mission.
We appreciate, but do not require, attribution. An attribution usually includes the title,
author, publisher, and ISBN. For example: “Book Title by Some Author (O’Reilly).
Copyright 2012 Some Copyright Holder, 978-0-596-xxxx-x.”
If you feel your use of code examples falls outside fair use or the permission given above,
feel free to contact us at [email protected].

Safari® Books Online


Safari Books Online is an on-demand digital library that delivers ex‐
pert content in both book and video form from the world’s leading
authors in technology and business.
Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research, prob‐
lem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organi‐
zations, government agencies, and individuals. Subscribers have access to thousands of
books, training videos, and prepublication manuscripts in one fully searchable database
from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Pro‐
fessional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John
Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT
Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technol‐
ogy, and dozens more. For more information about Safari Books Online, please visit us
online.

How to Contact Us
Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.


1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)

viii | Preface
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://www.oreilly.com/catalog/<catalog page>.
To comment or ask technical questions about this book, send email to bookques
[email protected].
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

Preface | ix
CHAPTER 1
Introduction

Graph databases address one of the great macroscopic business trends of today: lever‐
aging complex and dynamic relationships in highly-connected data to generate insight
and competitive advantage. Whether we want to understand relationships between
customers, elements in a telephone or datacenter network, entertainment producers
and consumers, or genes and proteins, the ability to understand and analyze vast graphs
of highly-connected data will be key in determining which companies outperform their
competitors over the coming decade.
For data of any significant size or value, graph databases are the best way to represent
and query connected data. Connected data is data whose interpretation and value re‐
quires us first to understand the ways in which its constituent elements are related. More
often than not, to generate this understanding, we need to name and qualify the con‐
nections between things.
While large corporates realized this some time ago, creating their own proprietary graph
processing technologies, we’re now in an era where that technology has rapidly become
democratized. Today, general-purpose graph databases are a reality, allowing main‐
stream users to experience the benefits of connected data without having to invest in
building their own graph infrastructure.
What’s remarkable about this renaissance of graph data and graph thinking is that graph
theory itself is not new. Graph theory was pioneered by Euler in the 18th century, and
has been actively researched and improved by mathematicians, sociologists, anthro‐
pologists, and others ever since. However, it is only in the last few years that graph theory
and graph thinking have been applied to information management. In that time, graph
databases have helped solve important problems in the areas of social networking, mas‐
ter data management, geospatial, recommendations, and more. This increased focus on
graph is driven by twin forces: by the massive commercial successes of companies such
as Facebook, Google, and Twitter, all of whom have centered their business models

1
around their own proprietary graph technologies; and by the introduction of general
purpose graph databases into the technology landscape.

Graphs are everywhere


Graphs are extremely useful in understanding a wide diversity of datasets in fields such
as science, government and business. The real world—unlike the forms-based model
behind the relational database—is rich and interrelated: uniform and rule-bound in
parts, exceptional and irregular in others. Once we understand graphs, we begin to see
them in all sorts of places. Gartner, for example, identifies five graphs in the world of
business—social, intent, consumption, interest, and mobile—and says that the ability
to leverage these graphs provides a “sustainable competitive advantage.”1

About This Book


The purpose of this book is to introduce graphs and graph databases to technology
practitioners, including developers, database professionals, and technology decision
makers. Reading this book, you will come away with a practical understanding of graph
databases. We show how the graph model “shapes” data, and how we query, reason
about, understand and act upon data using a graph database. We discuss the kinds of
problems that are well aligned with graph databases, with examples drawn from actual
real-world use cases. And we show how to plan and implement a graph database solu‐
tion.
While much of this book talks about graph data models, it is not a book about graph
theory.2 We don’t need much theory to take advantage of graph databases: provided we
understand what a graph is, we’re practically there. With that in mind, let’s refresh our
memories about graphs in general.

What is a Graph?
Formally a graph is just a collection of vertices and edges--or, in less intimidating lan‐
guage, a set of nodes and the relationships that connect them. Graphs represent entities
as nodes and the ways in which those entities relate to the world as relationships. This
general-purpose, expressive structure allows us to model all kinds of scenarios, from

1. http://www.gartner.com/id=2081316
2. For introductions to graph theory, see Richard J. Trudeau, Introduction To Graph Theory (Dover, 1993) and
Gary Chartrand, Introductory Graph Theory (Dover, 1985). For an excellent introduction to how graphs
provide insight into complex events and behaviors, see David Easley and Jon Kleinberg, Networks, Crowds,
and Markets: Reasoning about a Highly Connected World (Cambridge University Press, 2010)

2 | Chapter 1: Introduction
the construction of a space rocket, to a system of roads, and from the supply-chain or
provenance of foodstuff, to medical history for populations, and beyond.
For example, Twitter’s data is easily represented as a graph. In Figure 1-1 we see a small
network of followers. The relationships are key here in establishing the semantic context:
namely, that Billy follows Harry, and that Harry, in turn, follows Billy. Ruth and Harry
likewise follow each other, but sadly, while Ruth follows Billy, Billy hasn’t (yet) recip‐
rocated.

Figure 1-1. A small social graph

Of course, Twitter’s real graph is hundreds of millions of times larger than the example
in Figure 1-1, but it works on precisely the same principles. In Figure 1-2 we’ve expanded
the graph to include the messages published by Ruth.

What is a Graph? | 3
Figure 1-2. Publishing messages

Though simple, Figure 1-2 shows the expressive power of the graph model. It’s easy to
see that Ruth has published a string of messages. The most recent message can be found

4 | Chapter 1: Introduction
by following a relationship marked CURRENT; PREVIOUS relationships then create a time‐
line of posts.

The property graph model


In discussing Figure 1-2 we’ve also informally introduced the most popular variant of
graph model, the property graph.3 A property graph has the following characteristics:

• It contains nodes and relationships


• Nodes contain properties (key-value pairs)
• Relationships are named and directed, and always have a start and end node
• Relationships can also contain properties

Most people find the property graph model intuitive and easy to understand. While
simple, it can be used to describe the overwhelming majority of graph use cases in ways
that yield useful insights into our data.

A High Level View of the Graph Space


Numerous projects and products for managing, processing and analyzing graphs have
exploded onto the scene in recent years. The sheer number of technologies makes it
difficult to keep track of these tools and how they differ, even for those of us who are
active in the space. This section provides a high level framework for making sense of
the emerging graph landscape.
From 10,000 feet we can divide the graph space into two parts:

1. Technologies used primarily for transactional online graph persistence, typically


accessed directly in real-time from an application. These technologies are called
graph databases and are the main focus of this book. They are the equivalent of
“normal” OLTP database in the relational world.
2. Technologies used primarily for offline graph analytics, typically performed as a
series of batch steps. These technologies can be called graph compute engines. They
can be thought of as being in the same category as other technologies for analysis
of data in bulk, such as data mining and OLAP.

3. In the appendix, we discuss alternative graph data models in more detail.

A High Level View of the Graph Space | 5


Another way to slice the graph space is to look at the graph models
employed by the various technologies. There are three dominant graph
data models: the property graph, RDF triples and hypergraphs. We de‐
scribe these in detail in Appendix A. Most of the popular graph data‐
bases on the market use the property graph model, and in consequence,
it’s the model we’ll use throughout the remainder of this book.

Graph Databases
A graph database management system (henceforth, a graph database) is an online da‐
tabase management system with Create, Read, Update and Delete methods that expose
a graph data model. Graph databases are generally built for use with transactional
(OLTP) systems. Accordingly, they are normally optimized for transactional perfor‐
mance, and engineered with transactional integrity and operational availability in mind.
There are two properties of graph databases you should consider when investigating
graph database technologies:

1. The underlying storage. Some graph databases use native graph storage that is op‐
timized and designed for storing and managing graphs. Not all graph database
technologies use native graph storage however. Some serialize the graph data into
a relational database, an object-oriented database, or some other general-purpose
data store.
2. The processing engine. Some definitions require that a graph database use index-
free adjacency, meaning that connected nodes physically “point” to each other in
the database.4 Here we take a slightly broader view: any database that from the user’s
perspective behaves like a graph database, i.e. exposes a graph data model through
CRUD operations, qualifies as a graph database. We do acknowledge however the
significant performance advantages of index-free adjacency, and therefore use the
term native graph processing to describe graph databases that leverage index-free
adjacency.

4. See Rodriguez, M.A., Neubauer, P., “The Graph Traversal Pattern,” 2010 (http://arxiv.org/abs/1004.1001)

6 | Chapter 1: Introduction
It’s important to note that native graph storage and native graph pro‐
cessing are neither good nor bad—they’re simply classic engineering
tradeoffs. The benefit of native graph storage is that its purpose-built
stack is engineered for performance and scalability. The benefit of non-
native graph storage, in contrast, is that it typically depends on a mature
non-graph backend (such as MySQL) whose production characteristics
are well understood by operations teams. Native graph processing
(index-free adjacency) benefits traversal performance, but at the ex‐
pense of making some non-traversal queries difficult or memory in‐
tensive.

Relationships are first-class citizens of the graph data model, unlike other database
management systems, which require us to infer connections between entities using
contrived properties such as foreign keys, or out-of-band processing like map-reduce.
By assembling the simple abstractions of nodes and relationships into connected struc‐
tures, graph databases allow us to build arbitrarily sophisticated models that map closely
to our problem domain. The resulting models are simpler and at the same time more
expressive than those produced using traditional relational databases and the other
NOSQL stores.
Figure 1-3 shows a pictorial overview of some of the graph databases on the market
today based on their storage and processing models:

A High Level View of the Graph Space | 7


Figure 1-3. An overview of the graph database space

Graph Compute Engines


A graph compute engine is a technology that enables global graph computational algo‐
rithms to be run against large data sets. Graph compute engines are designed to do things
like identify clusters in your data, or answer questions such as, “how many relationships,
on average, does everyone in a social network have?”
Because of their emphasis on global queries, graph compute engines are normally op‐
timized for scanning and processing large amounts of information in batch, and in that
respect they are similar to other batch analysis technologies, such as data mining and
OLAP, familiar in the relational world. While some graph compute engines include a
graph storage layer, others (and arguably most) concern themselves strictly with pro‐
cessing data that is fed in from an external source, and returning the results.

8 | Chapter 1: Introduction
Figure 1-4. A high level view of a typical graph compute engine deployment

A variety of different types of graph compute engines exist. Most notably there are in-
memory/single machine graph compute engines like Cassovary, and distributed graph
compute engines like Pegasus or Giraph. Most distributed graph compute engines are
based on the Pregel white paper, authored by Google, which describes the graph com‐
pute engine Google uses to rank pages.5

This book focuses on graph databases


The previous section provided a course-grained overview of the entire graph space. The
rest of this book focuses on graph databases. Our goal throughout is to describe graph
database concepts. Where appropriate, we illustrate these concepts with examples drawn
from our experience of developing solutions using the property graph model and the
Neo4j database. Irrespective of the graph model or database used for the examples,
however, the important concepts carry over to other graph databases.

5. Cassovary: https://github.com/twitter/cassovary. Pegasus: http://www.cs.cmu.edu/~pegasus/. Giraphe: http://


incubator.apache.org/giraph/. Pregel: http://dl.acm.org/citation.cfm?id=1807184.

A High Level View of the Graph Space | 9


The Power of Graph Databases
Notwithstanding the fact that just about anything can be modeled as a graph, we live in
a pragmatic world of budgets, project timelines, corporate standards and commoditized
skill-sets. That a graph database provides a powerful but novel data modeling technique
does not in itself provide sufficient justification for replacing a well-established, well-
understood data platform; there must also be an immediate and very significant practical
benefit. In the case of graph databases, this motivation exists in the form of a set of use
cases and data patterns whose performance improves by one or more orders of mag‐
nitude when implemented in a graph, and whose latency is much lower compared to
batch processing of aggregates. On top of this performance benefit, graph databases
offer an extremely flexible data model, and a mode of delivery aligned with today’s agile
software delivery practices.

Performance
One compelling reason, then, for choosing a graph database is the sheer performance
increase when dealing with connected data versus relational databases and NOSQL
stores. In contrast to relational databases, where join-intensive query performance de‐
teriorates as the dataset gets bigger, with a graph database performance tends to remain
relatively constant, even as the dataset grows. This is because queries are localized to a
portion of the graph. As a result, the execution time for each query is proportional only
to the size of the part of the graph traversed to satisfy that query, rather than the size of
the overall graph.

Flexibility
As developers and data architects we want to connect data as the domain dictates,
thereby allowing structure and schema to emerge in tandem with our growing under‐
standing of the problem space, rather than being imposed upfront, when we know least
about the real shape and intricacies of the data. Graph databases address this want
directly. As we show in Chapter 3, the graph data model expresses and accommodates
the business’ needs in a way that enables IT to move at the speed of business.
Graphs are naturally additive, meaning we can add new kinds of relationships, new
nodes, and new subgraphs to an existing structure without disturbing existing queries
and application functionality. These things have generally positive implications for de‐
veloper productivity and project risk. Because of the graph model’s flexibility, we don’t
have to model our domain in exhaustive detail ahead of time—a practice which is all
but foolhardy in the face of changing business requirements. The additive nature of
graphs also means we tend to perform fewer migrations, thereby reducing maintenance
overhead and risk.

10 | Chapter 1: Introduction
Agility
We want to be able to evolve our data model in step with the rest of our application,
using a technology aligned with today’s incremental and iterative software delivery
practices. Modern graph databases equip us to perform frictionless development and
graceful systems maintenance. In particular, the schema-free nature of the graph data
model, coupled with the testable nature of a graph database’s API and query language,
empower us to evolve an application in a controlled manner.
Graph users cannot rely on fixed schemas to provide some level of governance at the
level of the database. But this is not a risk; rather it presents an opportunity to implement
more visible, actionable governance. As we show in Chapter 4, governance is typically
applied in a programmatic fashion, using tests to drive out the data model and queries,
as well as assert the business rules that depend upon the graph. This is no longer a
controversial practice: more so than relational development, graph database develop‐
ment aligns well with today’s agile and test-driven software development practices, al‐
lowing graph database-backed applications to evolve in step with changing business
environment.

Summary
In this chapter we’ve defined connected data and reviewed the graph property model,
a simple yet expressive tool for representing connected data. Property graphs capture
complex domains in an expressive and flexible fashion, while graph databases make it
easy to develop applications that manipulate our graph models.
In the next chapter we’ll look in more detail at how several different technologies address
the challenge of connected data, starting with relational databases, moving onto aggre‐
gate NOSQL stores, and ending with graph databases. In the course of the discussion,
we’ll see why graphs and graph databases provide the best means for modeling, storing
and querying connected data. Later chapters then go on to show how to design and
implement a graph database-based solution.

Summary | 11
CHAPTER 2
Options for Storing Connected Data

We live in a connected world. To thrive and progress, we need to understand and in‐
fluence the web of connections that surrounds us.
How do today’s technologies deal with the challenge of connected data? In this chapter
we look at how relational databases and aggregate NOSQL stores manage graphs and
connected data, and compare their performance to that of a graph database.1

Relational Databases Lack Relationships


For several decades, developers have tried to accommodate connected, semi-structured
datasets inside relational databases. But whereas relational databases were initially de‐
signed to codify paper forms and tabular structures—something they do exceedingly
well—they struggle when attempting to model the ad hoc, exceptional relationships that
crop up in the real world. Ironically, relational databases deal poorly with relationships.
Relationships do exist in the vernacular of relational databases, but only as a means of
joining tables. In our discussion of connected data in the previous chapter, we men‐
tioned we often need to disambiguate the semantics of the relationships that connect
entities, as well as qualify their weight or strength. Relational relations do nothing of
the sort. Worse still, as outlier data multiplies, and the overall structure of the dataset
becomes more complex and less uniform, the relational model becomes burdened with
large join tables, sparsely populated rows, and lots of null-checking logic. The rise in
connectedness translates in the relational world into increased joins, which impede
performance and make it difficult for us to evolve an existing database in response to
changing business needs.

1. For readers interested in exploring the topic of NOSQL, Appendix A describes the four major types of NOSQL
databases

13
Figure 2-1 shows a relational schema for storing customer orders in a customer-centric,
transactional application.

Figure 2-1. Semantic relationships are hidden in a relational database

The application exerts a tremendous influence over the design of this schema, making
some queries very easy, others more difficult:

• Join tables add accidental complexity; they mix business data with foreign key met‐
adata.
• Foreign key constraints add additional development and maintenance overhead
just to make the database work.
• Sparse tables with nullable columns require special checking in code, despite the
presence of a schema.
• Several expensive joins are needed just to discover what a customer bought.
• Reciprocal queries are even more costly. “What products did a customer buy?” is
relatively cheap compared to “which customers bought this product?”, which is the
basis of recommendation systems. We could introduce an index, but even with an
index, recursive questions such as “which customers bought this product who also
bought that product?” quickly become prohibitively expensive as the degree of re‐
cursion increases.

Relational databases struggle with highly-connected domains. To understand the cost


of performing connected queries in a relational database, we’ll look at some simple and
not-so-simple queries in a social network domain.
Figure 2-2 shows a simple join-table arrangement for recording friendships.

Figure 2-2. Modeling friends and friends-of-friends in a relational database

Asking “who are Bob’s friends?” is easy:


Example 2-1. Bob’s friends
SELECT PersonFriend.friend
FROM Person JOIN PersonFriend

14 | Chapter 2: Options for Storing Connected Data


Another Random Document on
Scribd Without Any Related Topics
primitive tribe of Sumatra, resort when they wish to obtain male or female
offspring. If parents have several sons and desire that the next child shall be
a girl, they dress the boys as girls, cut their hair after the girlish fashion,
and hang necklaces round their necks. On the contrary, when they have
many daughters and wish to have a son, they dress the girls up as boys.714

On the whole we conclude that the custom of men dressing as women and
of women dressing as men has been practised from a variety of
superstitious motives, among which the principal would seem to be the wish
to please certain powerful spirits or to deceive others.

§ 2. Prostitution of Unmarried Girls.

Like many peoples of Western Asia in antiquity, the Pelew Islanders


systematically prostitute their unmarried girls for hire. Hence, just as in
Lydia and Cyprus of old, the damsels are a source of income to their family,
and women wait impatiently for the time when their young daughters will be
able to help the household by their earnings. Indeed the mother regularly
anticipates the time by depriving the girl of her virginity with her own
f
hands.715 Hence the theory that the prostitution of unmarried girls is a
device to destroy their virginity without risk to their husbands is just as
inapplicable to the Pelew Islanders as we have seen it to be to the peoples
of Western Asia in antiquity. When a Pelew girl has thus been prepared for
her vocation by her mother, she sells her favours to all the men of her
village who can pay for them and who do not belong to her own exogamous
clan; but she never grants her favours to the same man twice. Accordingly
in every village of the Pelew Islands it may be taken as certain that the men
and women know each other carnally, except that members of the same
clan are debarred from each other by the rule of exogamy.716 Thus a well-
f
marked form of sexual communism, limited only by the exogamous
prohibitions which attach to the clans, prevails among these people. Nor is
this communism restricted to the inhabitants [pg 265] of the same village,
for the girls of each village are regularly sent away to serve as prostitutes
(armengols) in another village. There they live with the men of one of the
many clubs or associations (kaldebekels) in the clubhouse (blay), attending
to the house, consorting freely with the men, and receiving pay for their
services. A girl leading this life in the clubhouse of another village is well
treated by the men: a wrong done to her is a wrong done to the whole club;
and in her own village her value is increased, not diminished, by the time
she thus spends as a prostitute in a neighbouring community. After her
period of service is over she may marry either in the village where she has
served or in her own. Sometimes many or all of the young women of a
village go together to act as prostitutes (armengols) in a neighbouring
village, and for this they are well paid by the community which receives
them. The money so earned is divided among the chiefs of the village to
which the damsels belong. Such a joint expedition of the unmarried girls of
a village is called a blolobol. But the young women never act as armengols
in any clubhouse of their own village.717

Thus, while the Pelew custom of prostituting the unmarried girls to all the
men of their own village, but not of their own clan, is a form of sexual
communism practised within a local group, the custom of prostituting them
to men of other villages is a form of sexual communism practised between
members of different local groups; it is a kind of group-marriage. These
customs of the Pelew Islanders therefore support by analogy the hypothesis
that among the ancient peoples of Western Asia also the systematic
prostitution of unmarried women may have been derived from an earlier
period of sexual communism.718

A somewhat similar custom prevails in Yap, one of the western group of the
Caroline Islands, situated to the north of the Pelew group. In each of the
men's clubhouses “are kept three or four unmarried girls or Mespil, whose
business it is to minister to the pleasures of the men of the particular clan or
brotherhood to which the building belongs. As with the Kroomen on the
f Gold Coast, each man, married or single, takes his turn by rotation in the
rites through which each girl must pass before she is deemed ripe for
f marriage. The natives say it is an ordeal or preliminary trial to fit them for
the cares and burden of maternity. She is rarely a girl of the same village,
and, of course, must be sprung from a different sept. Whenever she wishes
to become a Langin or respectable married woman, she may, and is thought
none the less of for her frailties as a Mespil.... But I believe this self-
immolation before marriage is confined to the daughters of the inferior
chiefs and [pg 266] commons. The supply of Mespil is generally kept up by
the purchase of slave girls from the neighbouring districts.”719 According to
another account a mespil “must always be stolen, by force or cunning, from
a district at some distance from that wherein her captors reside. After she
has been fairly, or unfairly, captured and installed in her new home, she
loses no shade of respect among her own people; on the contrary, have not
her beauty and her worth received the highest proof of her exalted
perfection, in the devotion, not of one, but of a whole community of
lovers?”720 However, though the girl is nominally stolen from another district,
the matter is almost always arranged privately with the local chief, who
consents to wink hard at the theft in consideration of a good round sum of
shell money and stone money, which serves “to salve the wounds of a
disrupted family and dispel all thoughts of a bloody retaliation. Nevertheless,
the whole proceeding is still carried out with the greatest possible secrecy
and stealth.”721

§ 3. Custom of slaying Chiefs.

In the Pelew Islands when the chief of a clan has reigned too long or has
made himself unpopular, the heir has a formal right to put him to death,
though for reasons which will appear this right is only exercised in some of
the principal clans. The practice of regicide, if that word may be extended to
the assassination of chiefs, is in these islands a national institution regulated
by exact rules, and every high chief must lay his account with it. Indeed so
well recognized is the custom that when the heir-apparent, who under the
system of mother-kin must be a brother, a nephew, or a cousin on the
mother's side, proves himself precocious and energetic, the people say, “The
cousin is a grown man. The chief's tobolbel is nigh at hand.”722

In such cases the plot of death is commonly so well hushed up that it


seldom miscarries. The first care of the conspirators is to discover where the
doomed man keeps his money. For this purpose an old woman will sleep for
some nights in the house and make inquiries quietly, till like a sleuth-hound
she has nosed the hoard. Then the conspirators come, and the candidate for
the chieftainship despatches his predecessor either with his own hand or by
the hand of a young cousin. Having done the deed he takes possession of
the official residence, and applies to the widow [pg 267] of the deceased
the form of persuasion technically known as meleket. This consists of
putting a noose round her neck, and drawing it tighter and tighter till she
consents to give up her late husband's money. After that the murderer and
his friends have nothing further to do for the present, but to remain quietly
in the house and allow events to take their usual course.
Meantime the chiefs assemble in the council-house, and the loud droning
notes of the triton-shell, which answers the purpose of a tocsin, summon
the whole population to arms. The warriors muster, and surrounding the
house where the conspirators are ensconced they shower spears and stones
at it, as if to inflict condign punishment on the assassins. But this is a mere
blind, a sham, a legal fiction, intended perhaps to throw dust in the eyes of
the ghost and make him think that his death is being avenged. In point of
fact the warriors take good care to direct their missiles at the roof or walls
of the house, for if they threw them at the windows they might perhaps
hurt the murderer. After this formality has been satisfactorily performed, the
f regicide steps out of the house and engages in the genial task of paying the
death duties to the various chiefs assembled. When he has observed this
indispensable ceremony, the law is satisfied: all constitutional forms have
been carried out: the assassin is now the legitimate successor of his victim
and reigns in his stead without any further trouble.

But if he has omitted to massacre his predecessor and has allowed him to
die a natural death, he suffers for his negligence by being compelled to
observe a long series of complicated and irksome formalities before he can
make good his succession in the eyes of the law. For in that case the title of
chief has to be formally withdrawn from the dead man and conferred on his
successor by a curious ceremony, which includes the presentation of a coco-
nut and a taro plant to the new chief. Moreover, at first he may not enter
the chief's house, but has to be shut up in a tiny hut for thirty or forty days
during all the time of mourning, and even when that is over he may not
come out till he has received and paid for a human head brought him by the
people of a friendly state. After that he still may not go to the sea-shore
until more formalities have been fully observed. These comprise a very
costly fishing expedition, which is conducted by the inhabitants of another
district and lasts for weeks. At the end of it a net full of fish is brought to
f the chief's house, and the people of the neighbouring communities are
summoned by the blast of trumpets. As soon as the stranger fishermen
have been publicly paid for their services, a relative of the new chief steps
across the net and solemnly splits a coco-nut in two with an old-fashioned
knife made of a Tridacna shell, while at the same time he bans all the evils
that might befall his kinsman. Then, without looking at the nut, he throws
the pieces on the ground, and if they [pg 268] fall so that the two halves lie
with the opening upwards, it is an omen that the chief will live long. The
pieces of the nut are then tied together and taken to the house of another
chief, the friend of the new ruler, and there they are kept in token that the
ceremony has been duly performed. Thereupon the fish are divided among
the people, the strangers receiving half. This completes the legal ceremonies
of accession, and the new chief may now go about freely. But these tedious
formalities and others which I pass over are dispensed with when the new
chief has proved his title by slaying his predecessor. In that case the
procedure is much simplified, but on the other hand the death duties are so
very heavy that only rich men can afford to indulge in the luxury of regicide.
Hence in the Pelew Islands of to-day, or at least of yesterday, the old-
fashioned mode of succession by slaughter is now restricted to a few
families of the bluest blood and the longest purses.723

If this account of the existing or recent usage of the Pelew Islanders sheds
little light on the motives for putting chiefs to death, it well illustrates the
business-like precision with which such a custom may be carried out, and
the public indifference, if not approval, with which it may be regarded as an
ordinary incident of constitutional government. So far, therefore, the Pelew
custom bears out the view that a systematic practice of regicide, however
strange and revolting it may seem to us, is perfectly compatible with a state
of society in which human conduct and human life are estimated by a
standard very different from ours. If we would understand the early history
of institutions, we must learn to detach ourselves from the prepossessions
of our own time and country, and to place ourselves as far as possible at the
standpoint of men in distant lands and distant ages.

[pg 269]
Index.

Aban, a Persian month, ii. 68

Abd-Hadad, priestly king of Hierapolis, i. 163 n. 3

Aberdeenshire, All Souls' Day in, ii. 79 sq.

Abi-baal, i. 51 n. 4

Abi-el, i. 51 n. 4

Abi-jah, King, his family, i. 51 n. 2;


“father of Jehovah,” 51 n. 4

Abi-melech, “father of a king,” i. 51 n. 4

Abi-milk (Abi-melech), king of Tyre, i. 16 n. 5

Abimelech massacres his seventy brothers, i. 51 n. 2

Abipones, of South America, their worship of the Pleiades, i. 258 n. 2

Abraham, his attempted sacrifice of Isaac, ii. 219 n. 1

Abruzzi, gossips of St. John in the, i. 245 n. 2;


marvellous properties attributed to water on St. John's Night in
the, 246;
Easter ceremonies in the, 256;
the feast of All Souls in the, ii. 77 sq.;
rules as to sowing seed and cutting timber in the, 133 n. 3

Abu Rabah, resort of childless wives in Palestine, i. 78, 79

Abydos, head of Osiris at, ii. 11;


the favourite burial-place of the Egyptians, 18 sq.;
specially associated with Osiris, 18, 197;
tombs of the ancient Egyptian kings at, 19;
the ritual of, 86;
hall of the Osirian mysteries at, 108;
representations of the Sed festival at, 151;
inscriptions at, 153;
temple of Osiris at, 198

Acacia, Osiris in the, ii. 111

Achaia, subject to earthquakes, i. 202

Acharaca, cave of Pluto at, i. 205 sq.

Acilisena, temple of Anaitis at, i. 38

Adad, Syrian king, i. 15;


Babylonian and Assyrian god of thunder and lightning, 163

Adana in Cilicia, i. 169 n. 3

Addison, Joseph, on the grotto dei cani at Naples, i. 205 n. 1

Adhar, a Persian month, ii. 68

Adom-melech or Uri-melech, king of Byblus, i. 14, 17

Adon, a Semitic title, i. 6 sq., 16 sq., 20, 49 n. 7

Adonai, title of Jehovah, i. 6 sq.

Adoni, “my lord,” Semitic title, i. 7;


names compounded with, 17

Adoni-bezek, king of Jerusalem, i. 17

Adoni-jah, elder brother of King Solomon, i. 51 n. 2

Adoni-zedek, king of Jerusalem, i. 17

Adonis, myth of, i. 3 sqq.;


Greek worship of, 6;
in Greek mythology, 10 sqq.;
in Syria, 13 sqq.;
monuments of, 29;
in Cyprus, 31 sqq., 49;
identified with Osiris, 32;
mourning for, at Byblus, 38;
said to be the fruit of incest, 43;
his mother Myrrha, 43;
son of Theias, 43 n. 4, 55 n. 4;
the son of Cinyras, 49;
the title of the sons of Phoenician kings in Cyprus, 49;
his violent death, 55;
music in the worship of, 55;
sacred prostitution in the worship of, 57;
inspired prophets in worship of, 76;
human representatives of, perhaps burnt, 110;
doves burned in honour of, 147;
personated by priestly kings, 223;
the ritual of, 223 sqq.;
his death and resurrection represented in his rites, 224 sq.;
festivals of, 224 sqq.;
flutes played in the laments for, 225 n. 3;
the ascension of, 225;
images of, thrown into the sea or springs, 225, 227 n. 3, 236;
born from a myrrh-tree, 227, ii. 110;
bewailed by Argive women, i. 227 n.;
analogy of his rites to Indian and European ceremonies, 227;
his death and resurrection interpreted as representations of the
decay and revival of vegetation, 227 sqq.;
interpreted as the sun, 228;
interpreted by the ancients as the god of the reaped and
sprouting corn, 229;
as a corn-spirit, 230 sqq.;
hunger the root of the worship of, 231;
perhaps [pg 270] originally a personification of wild vegetation,
especially grass and trees, 233;
the gardens of, 236 sqq.;
rain-charm in the rites of, 237;
resemblance of his rites to the festival of Easter, 254 sqq., 306;
worshipped at Bethlehem, 257 sqq.;
and the planet Venus as the Morning Star, 258 sq.;
sometimes identified with Attis, 263;
swine not eaten by worshippers of, 265;
rites of, among the Greeks, 298;
lamented by women at Byblus, ii. 23

Adonis and Aphrodite, i. 11 sq., 29, 280;


their marriage celebrated at Alexandria, 224

—— and Attis identified with Dionysus, ii. 127 n.

—— and Osiris, similarity between their rites, ii. 127

——, Attis, Osiris, their mythical similarity, i. 6, ii. 201

——, the river, its valley, i. 28 sqq.;


annual discoloration of the, 30, 225

Aedepsus, hot springs of Hercules at, i. 211 sq.

Aedesius, Sextilius Agesilaus, dedicates altar to Attis, i. 275 n. 1

Aegipan and Hermes, i. 157


Aelian, on impregnation of Judean maid by serpent, i. 81

Aeneas and Dido, i. 114 n. 1

Aeschylus, on Typhon, i. 156

Aesculapius, in relation to serpents, i. 80 sq.;


reputed father of Aratus, 80 sq.;
his shrines at Sicyon and Titane, 81;
his dispute with Hercules, 209 sq.

Aeson and Medea, i. 181 n. 1

Aetna, Latin poem, i. 221 n. 4

Africa, serpents as reincarnations of the dead in, i. 82 sqq.;


infant burial in, 91 sq.;
reincarnation of the dead in, 91 sq.;
annual festivals of the dead in, ii. 66;
worship of dead kings and chiefs in, 160 sqq.;
supreme gods in, 165, 173 sq., 174, 186, with n. 5, 187 n. 1,
188 sq., 190;
worship of ancestral spirits among the Bantu tribes of, 174 sqq.;
inheritance of the kingship under mother-kin in, 211

——, North, custom of bathing at Midsummer among the


Mohammedan peoples of, i. 249

——, West, sacred men and women in, i. 65 sqq.;


human sacrifices in, ii. 99 n. 2

Afterbirth or placenta regarded as a person's double or twin, ii. 169


sq.
See also Placenta

Afterbirths buried in banana groves, i. 93;


regarded as twins of the children, 93;
Shilluk kings interred where their afterbirths are buried, ii. 162

Agbasia, West African god, i. 79

Agdestis, a man-monster in the myth of Attis, i. 269

Agesipolis, King of Sparta, his conduct in an earthquake, i. 196

Agraulus, daughter of Cecrops, worshipped at Salamis in Cyprus, i.


145, 146

Agricultural peoples worship the moon, ii. 138 sq.

Agriculture, religious objections to, i. 88 sqq.;


in the hands of women in the Pelew Islands, ii. 206 sq.;
its tendency to produce a conservative character, 217 sq.

Ahts of Vancouver Island regard the moon as the husband of the


sun, ii. 139 n. 1

Airi, a deity of North-West India, i. 170

Aiyar, N. Subramhanya, on Indian dancing-girls, i. 63 sqq.

Ajax and Teucer, names of priestly kings of Olba, i. 144 sq., 161

Akhetaton (Tell-el-Amarna), the capital of Amenophis IV., ii. 123 n. 1

Akikuyu of British East Africa, their worship of snakes, i. 67 sq.;


their belief in serpents as reincarnations of the dead, 82, 85

Alaska, the Esquimaux of, ii. 51;


the Koniags of, 106

Albania, marriage custom in, ii. 246

Albanians of the Caucasus, their worship of the moon, i. 73


Albinoes the offspring of the moon, i. 91

Albiruni, Arab geographer, on the Persian festival of the dead, ii. 68

Alcman on dew, ii. 137

Aleutians, effeminate sorcerers among the, ii. 254

Alexander Severus, at festival of Attis, i. 273

Alexander the Great expels a king of Paphos, i. 42;


his fabulous birth, 81;
assumes costumes of deities, 165;
sacrifices to Megarsian Athena, 169 n. 3

Alexandria, festival of Adonis at, i. 224;


the Serapeum at, ii. 119 n., 217

Alexandrian calendar, used by Plutarch, ii. 84

—— year, the fixed, ii. 28, 92;


Plutarch's use of the, 49

All Saints, feast of, perhaps substituted for an old pagan festival of
the dead, ii. 82 sq.

All Souls, feast of, ii. 51 sqq.;


originally a pagan festival of the dead, 81;
instituted by Odilo, abbot of Clugny, 82

Allatu, Babylonian goddess, i. 9

[pg 271]

Allifae in Samnium, baths of Hercules at, i. 213 n. 2

Almo, procession to the river, in the rites of Attis, i. 273.


Almond causes virgin to conceive, i. 263;
the father of all things, 263 sq.

Alyattes, king of Lydia, i. 133 n. 1

Alynomus, king of Paphos, i. 43

Amambwe, a Bantu tribe of Northern Rhodesia, its head chief


reincarnated in a lion, ii. 193

Amasis, king of Egypt, his body burnt by Cambyses, i. 176 n. 2

Amathus, in Cyprus, Adonis and Melcarth at, i. 32, 117;


statue of lion-slaying god found at, 117

Amatongo, ancestral spirits (Zulu term), i. 74 n. 4, ii. 184

Ambabai, an Indian goddess, i. 243

Ambala District, Punjaub, i. 94

Amélineau, E., discovers the tomb of King Khent, ii. 21 n. 1

Amenophis IV., king of Egypt, his attempt to abolish all gods but the
sun-god, ii. 123 sqq.

America, reincarnation of the dead in, i. 91;


the moon worshipped by the agricultural Indians of tropical, ii.
138

Amestris, wife of Xerxes, her sacrifice of children, ii. 220 sq.

Ammon, Milcom, the god of, i. 19

Ammon (the Egyptian) at Thebes, his human wives, i. 72;


of Thebes identified with the sun, ii. 123;
rage of King Amenophis IV. against the god, 124
Amoor, Gilyaks of the, i. 278 n. 2

Amorites, their law as to fornication, i. 37 sq.

Amsanctus, the valley of, i. 204 sq.

Amulets, crowns and wreaths as, ii. 242 sq.

Amyclae, in the vale of Sparta, i. 313, 314, 315

Amyclas, father of Hyacinth, i. 313

Anacreon, on Cinyras, i. 55

Anacyndaraxes, father of Sardanapalus, i. 172

Anaitis, sacred prostitution in the worship of, i. 38

Anassa, “Queen,” title of goddess, i. 35 n. 2

Anazarba or Anazarbus, in Cilicia, i. 167 n. 1

Ancestor-worship among the Khasis of Assam, ii. 203;


combined with mother-kin tends to a predominance of
goddesses over gods in religion, 211 sq.

Ancestors, propitiation of deceased, i. 46;


the worship of, the main practical religion of the Bantu tribes, ii.
176 sqq.

Ancestral spirits on shoulders of medicine-men, i. 74 n. 4;


incarnate in serpents, 82 sqq.;
in the form of animals, 83;
worshipped by the Bantu tribes of Africa, ii. 174 sqq.;
prayers to, 175 sq., 178 sq., 183 sq.;
sacrifices to, 175, 178 s.q., 180, 181 sq., 183 sq., 190;
on the father's and on the mother's side, the two distinguished,
180, 181.
See also Dead

Anchiale in Cilicia, i. 144; monument of Sardanapalus at, 172

Andania in Messenia, sacred men and women at, i. 76 n. 3

Andriamasinavalona, a Hova king, vicarious sacrifice for, ii. 221

Anemone, the scarlet, sprung from the blood of Adonis, i. 226

Angel, the Destroying, over Jerusalem, i. 24

Angus, belief as to the weaning of children in, ii. 148

Anhalt, custom at sowing in, i. 239

Animals sacrificed by being hanged, i. 289 sq., 292;


and plants, edible, savage lamentations for, ii. 43 sq.;
dead kings and chiefs incarnate in, 162, 163 sq., 173, 193;
sacrificed to prolong the life of kings, 222

Anje-a, a mythical being who brings children to women, i. 103

Anklets made of human sinews worn by king of Uganda, ii. 224 sq.

Ankole, in Central Africa, the Bahima of, ii. 190

Anna, sister of Dido, i. 114 n. 1

Annam, offerings to the dead in spring in, i. 235 n. 1;


annual festivals of the dead in, ii. 62 sqq.

Annual death and resurrection of gods, i. 6

Anointing as a ceremony of consecration, i. 21 n. 2 and 3, 68, 74

—— sacred stones, custom of, i. 36


Antelopes, soul of a dead king incarnate in, ii. 163

Anthesteria, festival of the dead at Athens, i. 234 sq.

Antigonus, King, i. 212

Antimachia in Cos, priest of Hercules at, ii. 258

Antioch, destroyed by an earthquake, i. 222 n. 1;


festival of Adonis at, 227, 257 sq.

Antiochus, Greek calendar of, i. 303 n. 3

Antwerp, feast of All Souls in, ii. 70

Anubis, Egyptian jackal-headed god, ii. 15, 18 n. 3, 22 n. 2;


finds the body of Osiris, 85

Apameia, worship of Poseidon at, i. 195

Aphaca in Syria, sanctuary of Astarte at, i. 28, 259;


meteor as signal for festival at, 259

[pg 272]

Aphrodite, her sacred doves, i. 33, 147;


sanctuary of, at Paphos, 33 sqq.;
the month of, 145;
her blood dyes white roses red, 226;
name applied to summer, ii. 41

—— and Adonis, i. 11 sq., 29, 280;


their marriage celebrated at Alexandria, 224

—— and Cinyras, i. 48 sq.

—— and Pygmalion, i. 49 sq.


—— of the Lebanon, the mourning, i. 29 sq.

Apinagos Indians of Brazil, their dances and presentation of children


to the moon, ii. 145 sqq.

Apis, sacred Egyptian bull, ii. 11, 119 n.;


mourning for the death of, i. 225;
held to be an image of the soul of Osiris, ii. 130

Apollo, the friend of Cinyras, i. 54;


music in the worship of, 54 sq.;
reputed father of Augustus, 81;
the Catalonian, 147 n. 3;
his musical contest with Marsyas, 288;
purified at Tempe, ii. 240

—— and Artemis, their priesthood at Ephesus, ii. 243 sq.

—— and Marsyas, i. 55

—— at Delphi, sacrifices of Croesus to, i. 180 n. 1;


and the Dragon at Delphi, ii. 240

—— of the Golden Sword, i. 176

—— the Four-handed, ii. 250 n. 2

Apotheosis by being burnt alive, i. 179 sq.

Appian, on the costume of a priest of Isis, ii. 85 n. 3

Apples forbidden to worshippers of Cybele and Attis, i. 280 n. 7

Apuleius, on the worship of Isis, ii. 119 n.

Arab name for the scarlet anemone, i. 226

Arabic writer on the mourning for Tá-uz (Tammuz) in Harran, i. 230


Arabs resort to the springs of Callirrhoe in Moab, i. 215 sq.

—— of Moab, their custom at harvest, ii. 48, 96;


their remedies for ailments, 242

Aratus of Sicyon, deemed a son of Aesculapius, i. 81

Araucanian Indians of South America eat fruit of Araucanian pine, i.


278 n. 2

Araunah, the threshing-floor of, i. 24

Arcadians sacrifice to thunder and lightning, i. 157

Archigallus, high-priest of Attis, i. 268, 279;


prophesies, 271 n.

Arctic origin, alleged, of the Aryans, i. 229 n. 1

Arenna or Arinna, i. 136 n. 1;


the sun-goddess of, 136

Arensdorf, custom at sowing in, i. 239

Argaeus, Mount, in Cappadocia, i. 190 sq.

Argive brides wore false beards, ii. 260

—— women bewail Adonis, i. 227 n.

Aristomenes, Messenian hero, his fabulous birth, i. 81

Aristophanes, on the Spartan envoy, i. 196 n. 4;


on Hercules as patron of hot springs, 209

Aristotelian philosophy, revival of the, i. 301

Aristotle on the political institutions of Cyprus, i. 49 n. 7;


on earthquakes, 211 n. 3

Armengols, in the Pelew Islands, ii. 265

Armenia, sacred prostitution of girls before marriage in, i. 38, 58

Armenians, their festivals of the dead, ii. 65 sq.;


their opinion of the baleful influence of the moon on children,
148

Arrian on Attis, i. 282

Artemis at Perga, i. 35;


name given by Greeks to Asiatic Mother Goddesses, 169

—— and Apollo, their priesthood at Ephesus, ii. 243

—— of Ephesus served by eunuch priests, i. 269

—— the Hanged, i. 291

——, Laphrian, at Patrae, i. 126 n. 2

——, Perasian, at Castabala, i. 115, 167 sqq.

——, Sarpedonian, in Cilicia, i. 167, 171

—— Tauropolis, i. 275 n. 1

——, the Tauric, human sacrifices to the, i. 115

Artemision, a Greek month, ii. 239 n. 1

Arunta of Central Australia, their belief in the reincarnation of the


dead, i. 99, 100

Arval Brethren, their wreaths of corn, i. 44 n.;


a Roman college of priests, ii. 239
Aryan family, marriage customs of the, ii. 235

Aryans, their alleged Arctic origin, i. 229 n. 1;


annual festivals of the dead among the, ii. 67 sqq.

Aryenis, daughter of Alyattes, i. 133 n. 1

Ascalon, the goddess Derceto at, i. 34 n. 3

Ascension of Adonis, i. 225

Ashantee, human sacrifices at earthquakes in, i. 201;


kings of, their human sacrifices, ii. 97 n. 7

Asherim, sacred poles, i. 18, 18 n. 2, 107, 108

Ashes of human victims scattered by winnowing-fans, ii. 97, 106

Ashtoreth (Astarte), i. 18 n. 2 See Astarte

Ashurbanipal, king of Assyria, i. 144;


confused with the legendary Sardanapalus, [pg 273] 173 sq.;
carries off the bones of the kings of Elam, ii. 103

Ashvin, an Indian month, i. 243

Asia Minor, priestly dynasties of, i. 140 sq.;


subject to volcanic forces, 190;
subject to earthquakes, 202

Asiatic goddesses of fertility served by eunuch priests, i. 269 sq.

Asopus, the river, i. 81

“A-souling,” custom of, in England, ii. 79

Aspalis, a form of Artemis, i. 292


Assam, the Khasis of, i. 46, ii. 202 sqq.;
the Tangkul Nagas of, ii. 57 sqq.

Assumption of the Virgin and the festival of Diana, i. 308, 309

Assyrian cavalry, i. 25 n. 3

Assyrians in Cilicia, i. 173

Astarte at Byblus, i. 13 sq.;


and the asherim, 18;
kings as priests of, 26;
at Paphos, 33 sqq.;
doves sacred to, 147;
identified with the planet Venus, 258;
of the Syrian Hierapolis served by eunuch priests, 269 sq.;
called by Lucian the Assyrian Hera, 280 n. 5;
the Heavenly Goddess, 303;
the planet Venus her star, ii. 35

—— Aphrodite, i. 304 n.

Asteria, mother of the Tyrian Hercules (Melcarth), i. 112

Astyages, king of the Medes, i. 133 n. 1

Asvattha tree, i. 82

Atargatis, Syrian goddess, i. 34 n. 3, 137;


worshipped at Hierapolis-Bambyce, 162 sq.;
derivation of the name, 162;
her husband-god, 162 sq.

Ates, a Phrygian, i. 286

Athamas, the dynasty of, i. 287

Athanasius, on the mourning for Osiris, ii. 217


'Atheh, Cilician goddess, i. 162

Athena, temple of, at Salamis in Cyprus, i. 145;


and hot springs, 209, 210

——, Magarsian, a Cilician goddess, i. 169 n. 3

—— Sciras, sanctuary of, ii. 238

Athenian boys, race of, at the vintage, ii. 238;


boy carrying an olive-branch in procession, 238

Athenians, their superstition as to an eclipse of the moon, ii. 141

Athens, sacred serpent at, i. 87;


the Commemoration of the Dead at, 234;
sacrifice of an ox at, 296 sq.;
marriage custom at, ii. 245

Athribis, heart of Osiris at, ii. 11

Athyr, Egyptian month, ii. 8, 41, 49 n. 1;


Osiris murdered on the seventeenth day of, 8, 84;
festival of Osiris in the month of, 84 sqq., 91

Atonga, tribe of Lake Nyassa, their theory of earthquakes, i. 199

Attica, summer festival of Adonis in, i. 226

Attis, priests of Cybele called, i. 140;


sometimes identified with Adonis, 263;
myth and ritual of, 263 sqq.;
beloved by Cybele, 263, 282;
legends of his death, 264;
his legend at Pessinus, 264;
his self-mutilation, 264 sq.;
and the pine-tree, 264, 265, 267, 271, 277 sq., 285, ii. 98 n. 5;
his eunuch priests, i. 265, 266;
festival of his death and resurrection in March, 267 sqq., 272
sq., 307 sq.;
violets sprung from the blood of, 267;
the mourning for, 272;
bath of bull's blood in the rites of, 274 sqq.;
mysteries of, 274 sq.;
as a god of vegetation, 277 sqq., 279;
as the Father God, 281 sqq.;
identified with Zeus, 282;
as a sky-god, 282 sqq.;
emasculation of, suggested explanation of myth, 283;
his star-spangled cap, 284;
identified with Phrygian moon-god Men Tyrannus, 284;
human representatives of, 285 sqq.;
title borne by priests of Cybele, 285, 287

——, Adonis, Osiris, their mythical similarity, i. 6, ii. 201

Atys, son of Croesus, his death, i. 286;


early king of Lydia, 286

Aubrey, John, on soul-cakes, ii. 78

Augustine on the effeminate priests of the Great Mother, i. 298;


on the heathen origin of Christmas, 305;
on the discovery of corn by Isis, ii. 116;
on Salacia as the wife of Neptune, 233

Augustodunum (Autun), worship of Cybele at, i. 279

Augustus reputed a son of Apollo, i. 81

Aulus Gellius on the influence of the moon, ii. 132

Aun, or On, King of Sweden, sacrifices his sons to Odin, ii. 220
Aunis, feast of All Souls in, ii. 69 sq.

Aurelia Aemilia, a sacred harlot, i. 38

Aurohuacas, Indians of Colombia, i. 23 n. 2

Aust, E., on the marriage of the Roman gods, ii. 236 n. 1

Australia, belief as to the reincarnation of the dead in, i. 99 sqq.

Australian aborigines, their preparation for marriage, i. 60;


their belief in conception without sexual intercourse, 99 sqq.;
their cuttings for the dead, 268

Austria, leaping over Midsummer fires in, i. 251

“Awakening of Hercules,” festival at Tyre, i. 111

[pg 274]

Awemba, Bantu tribe of Rhodesia, ii. 174;


their worship of ancestral spirits, 175;
their prayers to dead kings before going to war, 191 sq.

Axe, emblem of Hittite god of thundering sky, i. 134;


as divine emblem, 163;
symbol of Asiatic thunder-god, 183

——, double-headed, symbol of Sandan, i. 127;


carried by Lydian kings, 182;
a palladium of the Heraclid sovereignty, 182;
figured on coins, 183 n.

Ba-bwende, a tribe of the Congo, i. 271 n.

Ba-sundi, a tribe of the Congo, i. 271 n.

Baal, Semitic god, i. 15, 16;


royal names compounded with, 16;
as the god of fertility, 26 sq.;
conceived as god who fertilizes land by subterranean water, 159

—— and Sandan at Tarsus, i. 142 sq., 161

—— of the Lebanon, i. 32

—— of Tarsus, i. 117 sqq., 162 sq.

Baalath or Astarte, i. 26, 34

—— and Baal, i. 27

—— Gebal, i. 14

Baalbec, i. 28;
sacred prostitution at, 37;
image of Hadad at, 163

Baalim, firstlings and first-fruits offered to the, i. 27;


called lovers, 75 n.

Babylon, early kings of, worshipped as gods, i. 15;


worship of Mylitta at, 36;
religious prostitution at, 58;
human wives of Marduk at, 71;
sanctuary of Serapis at, ii. 119 n.

Babylonia, worship of Tammuz in, i. 6 sqq.;


the moon-god took precedence of the sun-god in ancient, ii.
138 sq.

Babylonian hymns to Tammuz, i. 9

Bacchanals tear Pentheus in pieces, ii. 98

Bacchic orgies suppressed by Roman government, i. 301 n. 2


Bacchylides as to Croesus on the pyre, i. 175 sq.

Backbone of Osiris represented by the ded pillar, ii. 108 sq.

Baden, feast of All Souls in, ii. 74

Baethgen, F., on goddess 'Hatheh, i. 162 n. 2

Baganda, their worship of the python, i. 86;


rebirth of the dead among the, 92 sq.;
their theory of earthquakes, 199;
their presentation of infants to the new moon, ii. 144, 145;
ceremony observed by the king at new moon, 147;
their worship of dead kings, 167 sqq.;
their veneration for the ghosts of dead relations, 191 n. 1;
their pantheon, 196;
human sacrifices offered to prolong the life of their kings, 223
sqq.

Bagishu (Bageshu) of Mount Elgon, reincarnation of the dead among


the, i. 92

Bagobos of the Philippine Islands, their theory of earthquakes, i.


200;
of Mindanao, their custom of hanging and spearing human
victims, 290 sq.

Baharutsis, a Bantu tribe of South Africa, ii. 179

Bahima, their belief as to dead kings and chiefs, i. 83 n. 1

—— of Ankole in Central Africa, their worship of the dead, ii. 190


sq.;
their belief in a supreme god Lugaba, 190

—— of Kiziba, ii. 173


Baigas, Dravidian tribe of India, their objection to agriculture, i. 89

Bailly, French astronomer, on the Arctic origin of the rites of Adonis,


i. 229

Bairu, the, of Kiziba, ii. 173

Baku, on the Caspian, perpetual fires at, i. 192

Balinese, their conduct in an earthquake, i. 198

Baloi, witches and wizards, ii. 104

Banana, women impregnated by the flower of the, i. 93

Bangalas of the Congo, rebirth of dead among the, i. 92. See also
Boloki

Bantu tribes, their belief in serpents as reincarnations of the dead, i.


82 sqq.;
their worship of ancestral spirits, ii. 174 sqq.;
their main practical religion a worship of ancestors, 176 sqq.;
their worship of the dead, 176 sqq., 191 sqq.

Banyoro, their worship of serpents, i. 86 n. 1

Baptism of bull's blood in the rites of Cybele, i. 274 sqq.

Bar-rekub, king of Samal, i. 15 sq.

Baralongs, a Bantu tribe of South Africa, ii. 179

Barea and Kunama, their annual festival of the dead, ii. 66

Barley forced for festival, i. 240, 241, 242, 244, 251 sq.

—— and wheat discovered by Isis, ii. 116


Barotse, a Bantu tribe of the Zambesi, their belief in a supreme god
Niambe, ii. 193;
their worship of dead kings, 194 sq.

Barren women resort to graves in order to get children, i. 90;


entice souls of dead children to them, 94

Barrenness of women cured by passing through holed stone, i. 36,


with n. 4;
removed by serpent, 86;
children murdered as a remedy for, 95

Barrows of Halfdan, ii. 100

[pg 275]
Barsom, bundle of twigs used by Parsee priests, i. 191 n. 2

Barth, H., on sculptures at BoghazKeui, i. 133 n. 1

Basil, pots of, on St. John's Day in Sicily, i. 245

Basuto chiefs buried secretly, ii. 104

Basutos, worship of the dead among the, ii. 179 sq.

Bataks of Sumatra, their theory of earthquakes, i. 199 sq.

Batara-guru, the Batak creator, i. 199 sq.

Bath in river at the rites of Cybele, i. 273, 274 n.;


of bull's blood in the rites of Attis, 274 sqq.;
of image of Cybele perhaps a rain-charm, 280

—— of Aphrodite, i. 280

—— of Demeter, i. 280

—— of Hera in the river Burrha, i. 280;


in the spring of Canathus, 280

Bathing on St. John's Day or Eve (Midsummer Day or Eve), i. 246


sqq.;
pagan origin of the custom, 249

Baths of Hercules, i. 212

—— of Solomon in Moab, i. 215


Batoo Bedano, an earthquake god, i. 202

Battle, purificatory ceremonies after a, ii. 251 sq.

—— of the gods and giants, i. 157

Baudissin, W. W. Graf von, on Tammuz and Adonis, i. 6 n. 1;


on Adonis as the personification of the spring vegetation, 228 n.
6;
on summer festival of Adonis, 232 n.

Bavaria, gardens of Adonis in, i. 244

Bawenda, the, of South Africa, the positions of their villages hidden,


ii. 251

Bearded Venus, in Cyprus, i. 165, ii. 259 n. 3

Beaufort, F., on perpetual flame in Lycia, i. 222 n.

Bechuana ritual at founding a new town, ii. 249

Bechuanas, their sacrifice of a blind bull on various occasions, ii.


249, 250 sq.

Bede, on the feast of All Saints, ii. 83

Beech, M. W. H., on serpent-worship, i. 85

Beena marriage in Ceylon, ii. 215

Begbie, General, i. 62 n.

Bel or Marduk at Babylon, i. 71

Belgium, feast of All Souls in, ii. 70

Bellerophon and Pegasus, i. 302 n. 4


Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like