You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,27 @@ Now you can make changes to the docs and see them being updated instantly, thank
67
67
68
68
**Note**: While running locally, the version selector does not work because you need to build the documentation and serve it behind a reverse proxy to have multiple versions. Also, formatting of lists is less fussy when running locally; so please precede lists with a blank line in your PR.
69
69
70
+
### Testing for broken links
71
+
72
+
We use [htmltest](https://github.com/wjdp/htmltest) to check for broken links in the generated documentation. To test for broken links after building the site:
73
+
74
+
1. Build the Hugo site:
75
+
```bash
76
+
hugo --destination=public --baseURL=http://example.com
77
+
```
78
+
79
+
2. Run htmltest:
80
+
```bash
81
+
htmltest
82
+
```
83
+
84
+
Or combine both steps:
85
+
```bash
86
+
hugo --destination=public --baseURL=http://example.com && htmltest 2>&1
87
+
```
88
+
89
+
The htmltest configuration is in `.htmltest.yml` at the root of the repository. It automatically ignores development-only files like `livereload.js` and empty hash links used for JavaScript interactions.
Copy file name to clipboardExpand all lines: content/dql/json-mutation-format.md
+43-2Lines changed: 43 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,49 @@ weight = 2
10
10
Dgraph supports [Mutations]({{< relref "dql-mutation.md" >}}) in JSON or [RDF]({{< relref "dql-rdf.md" >}}) format.
11
11
When using JSON format Dgraph creates nodes and relationships from the JSON structure and assigns UIDs to nodes.
12
12
13
+
## Quick Start Example
14
+
15
+
If you followed the [Quick Start guide]({{< relref "../quick-start.md" >}}), you added data to your graph using RDF format. The same data can also be added using JSON format. Here's an example of how to create the movie data from the quick start using JSON:
16
+
17
+
```dql
18
+
{
19
+
"set": [
20
+
{
21
+
"name": "Star Wars: Episode IV - A New Hope",
22
+
"release_date": "1977-05-25",
23
+
"director": {
24
+
"name": "George Lucas",
25
+
"dgraph.type": "Person"
26
+
},
27
+
"starring": [
28
+
{
29
+
"name": "Luke Skywalker"
30
+
},
31
+
{
32
+
"name": "Princess Leia"
33
+
},
34
+
{
35
+
"name": "Han Solo"
36
+
}
37
+
]
38
+
},
39
+
{
40
+
"name": "Star Trek: The Motion Picture",
41
+
"release_date": "1979-12-07"
42
+
}
43
+
]
44
+
}
45
+
```
46
+
47
+
The sample JSON data is an array of two movies with some attributes. These are stored as [nodes]({{< relref "../dgraph-glossary.md#node" >}}) in Dgraph.
48
+
49
+
The "Star Wars" movie has a `director` field which is a JSON object and a `starring` field which is an array of JSON objects. Each object is also stored as a node in Dgraph. The `director` and `starring` are stored as [relationships]({{< relref "../dgraph-glossary.md#relationship" >}}).
50
+
13
51
## Specifying node UIDs
14
52
15
-
For example, if you run this mutation:
53
+
When you create nodes using JSON mutations, Dgraph automatically assigns a [UID]({{< relref "../dgraph-glossary.md#uid" >}}) to each new node. Dgraph also generates an internal identifier during the transaction, which is then converted to the final UID.
54
+
55
+
For example, this mutation creates a single node:
16
56
17
57
```dql
18
58
{
@@ -24,7 +64,8 @@ For example, if you run this mutation:
0 commit comments