From 0324b61e0bc7769b2736417e6ac0c0f3d24bf2bc Mon Sep 17 00:00:00 2001 From: Teon Banek <teon.banek@memgraph.io> Date: Wed, 19 Jul 2017 14:48:20 +0200 Subject: [PATCH] Add a chapter in user documentation on data types Reviewers: florijan, buda Reviewed By: florijan Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D564 --- docs/user_technical/README.md | 1 + docs/user_technical/data-types.md | 36 ++++++++++++++++++++++++++++++ docs/user_technical/open-cypher.md | 17 ++++++++++---- 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 docs/user_technical/data-types.md diff --git a/docs/user_technical/README.md b/docs/user_technical/README.md index 14b2118ee..adebcb4fe 100644 --- a/docs/user_technical/README.md +++ b/docs/user_technical/README.md @@ -11,6 +11,7 @@ data structures, multi-version concurrency control and asynchronous IO. * [About Memgraph](#about-memgraph) * [Installation](installation.md) * [Quick Start](quick-start.md) + * [Storable Data Types](data-types.md) * [openCypher Query Language](open-cypher.md) * [Upcoming Features](upcoming-features.md) diff --git a/docs/user_technical/data-types.md b/docs/user_technical/data-types.md new file mode 100644 index 000000000..4388211f1 --- /dev/null +++ b/docs/user_technical/data-types.md @@ -0,0 +1,36 @@ +## Storable Data Types + +Since *Memgraph* is a *graph* database management system, data is stored in +the form of graph elements: nodes and edges. Each graph element can also +contain various types of data. This chapter describes which data types are +supported in *Memgraph*. + +### Node Labels & Edge Types + +Each node can have any number of labels. A label is a text value, which can be +used to *label* or group nodes according to users' desires. A user can change +labels at any time. Similarly to labels, each edge can have a type, +represented as text. Unlike nodes, which can have multiple labels or none at +all, edges *must* have exactly one edge type. Another difference to labels, is +that the edge types are set upon creation and never modified again. + +### Properties + +Nodes and edges can store various properties. These are like mappings or +tables containing property names and their accompanying values. Property names +are represented as text, while values can be of different types. Each property +name can store a single value, it is not possible to have multiple properties +with the same name on a single graph element. Naturally, the same property +names can be found across multiple graph elements. Also, there are no +restrictions on the number of properties that can be stored in a single graph +element. The only restriction is that the values must be of the supported +types. Following is a table of supported data types. + + Type | Description +-----------|------------ + `Null` | Denotes that the property has no value. This is the same as if the property does not exist. + `String` | A character string, i.e. text. + `Boolean` | A Boolean value, either `true` or `false`. + `Integer` | An integer number. + `Float` | A floating-point number, i.e. a real number. + `List` | A list containing any number of property values of any supported type. It can be used to store multiple values under a single property name. diff --git a/docs/user_technical/open-cypher.md b/docs/user_technical/open-cypher.md index 205f3f8be..d00cfb1e6 100644 --- a/docs/user_technical/open-cypher.md +++ b/docs/user_technical/open-cypher.md @@ -8,13 +8,13 @@ providing a powerful interface for working with graph based data. chapter contains the details of features which are implemented. Additionally, not yet supported features of the language are listed. - * [Reading existing Data](#reading-existing-data) - * [Writing new Data](#writing-new-data) + * [Reading Existing Data](#reading-existing-data) + * [Writing New Data](#writing-new-data) * [Reading & Writing](#reading-amp-writing) * [Indexing](#indexing) * [Other Features](#other-features) -### Reading existing Data +### Reading Existing Data The simplest usage of the language is to find data stored in the database. For that purpose, the following clauses are offered: @@ -188,7 +188,7 @@ Click [here](https://neo4j.com/docs/developer-manual/current/cypher/functions/aggregating/) for additional details on how aggregations work. -### Writing new Data +### Writing New Data For adding new data, you can use the following clauses. @@ -200,6 +200,9 @@ For adding new data, you can use the following clauses. You can still use the `RETURN` clause to produce results after writing, but it is not mandatory. +Details on which kind of data can be stored in *Memgraph* can be found in +[Storable Data Types](data-types.md) chapter. + #### CREATE This clause is used to add new nodes and edges to the database. The creation @@ -209,6 +212,12 @@ For example, to create 2 new nodes connected with a new edge, use this query. CREATE (node1) -[:edge_type]-> (node2) +Labels and properties can be set during creation using the same syntax as in +[MATCH](#match) patterns. For example, creating a node with a label and a +property: + + CREATE (node :Label {property: "my property value"} + Additional information on `CREATE` is [here](https://neo4j.com/docs/developer-manual/current/cypher/clauses/create/).