Basic graph data modeling
Basics of graph data modeling.
person
(vertex label) created
(edge) a
recipe
(vertex label). The properties are name
, used for both
a person
and a recipe
, and createDate
used as
an edge property for created
.name
and edge property
create_date
.DSE Graph supports multiplicity for both properties and edges. A single vertex can have multiple properties with the same property key. Properties default to a single values, but multiple values can be defined in the schema. If a vertex property requires its own properties, a meta-property can be defined. A graph can have multiple edges with the same edge label between a given pair of vertices. Multiple edges between two given vertices is the default, but the schema can define an edge label to support unique single edges between two given vertices.
Looking at the full data model, a person
vertex can have a
name
, as well as additional properties such as gender
and
nickname
. A reviewed
edge can have a multiple properties that
identify attributes of a recipe review for the adjoining recipe
. Or consider the
locations that a person has lived during their lifetime; a query can be aimed at discovering
where a person lived. Would it be interesting to know if Julia Child lived in France or the
United States while writing her first cookbook? It could be relevant if the cookbook is on French
cuisine. Meta-properties
start_date
and end_date
can pinpoint the required data. Since
Julia Child lived in multiple countries during her lifetime, the property
country
must be a multi-property to store multiple countries with respective
start and end dates.
You may wonder about deciding which entities and relationships are included in a graph data model. Let's take a look in the next section.