Data model introduction

Graph databases represent simple or complex relationships between objects. The objects can be any tangible or intangible objects, such as people, software, or locations. The analysis of the interaction of objects with one another and their environment can yield useful results. Unlike relational databases, graph databases are designed to make discovering the relationships between objects directly queryable.

DataStax Graph (DSG) is classified as a property graph, also called a directed, binary attributed multi-graph. Property graphs consist of three elements:

  • vertex

    A vertex defines an object such as a person, location, or recipe; think of a vertex as a noun. Each vertex has a unique identifier, and a single label that denotes the type of entity the vertex represents. Properties identify the partition keys and clustering keys to locate physical storage location, as well as additional non-primary key attributes. Two vertices are adjacent to one another if they share an edge, whereas a vertex is incident to an edge. Vertices may have one to many defined properties, with at least one partition key defined. For scale, the number of vertices can number in the billions.

    DataStax Graph limits the number of vertex and edge labels to 200 per graph.

  • edge

    An edge defines a directional binary relationship, or connection, between two vertices. A person can create software, or a person can write a book; think of edges as verbs. Each edge in DataStax Graph (DSG) has a unique identifier, and a single label that denotes the type of connection the edge represents. Multiple edges with the same direction and label can connect the same two vertices if the edge labels are created with unique clustering keys. For convenience, DSG stores each unique edge in one direction, but a special index inverse() can create opposite direction edges for any edge label. Edges may have two to many defined properties, with a partition key defined by the partition keys of the vertex labels. Edges are incident to a vertex. For scale, the number of edges can number in the billions.

  • property

    A property, which consists of a property key and a property value, defines the attributes of vertices or edges Properties can have multiple values or properties of properties using CQL collections, tuples, or user-defined types (UDTs). Properties are not mandatory for vertices or edges, except for the properties that define the partition keys.

dataModelVertexEdge

Not all queries are defined with primary keys, so indexing plays a critical role in querying graphs. A data model must also define the indexes used to find data in a graph using non-primary key information. DSG takes advantage of three built-in mechanisms to create indexes: materialized views (MVs), secondary indexes, and search indexes.

Each of these elements, as well as indexes, play a role in a well-design data model and the performance of graph queries.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com