Skip to content

Commit 48cde7a

Browse files
update quick start to use RDF
better quick start. Move the json mutation example to Json format page.
1 parent 946d96c commit 48cde7a

File tree

5 files changed

+478
-182
lines changed

5 files changed

+478
-182
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,27 @@ Now you can make changes to the docs and see them being updated instantly, thank
6767

6868
**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.
6969

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.
90+
7091
### Running docs locally with Docker
7192

7293
Make sure you have docker-compose installed.

content/dql/dql-get-started.md

Lines changed: 0 additions & 179 deletions
This file was deleted.

content/dql/json-mutation-format.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,49 @@ weight = 2
1010
Dgraph supports [Mutations]({{< relref "dql-mutation.md" >}}) in JSON or [RDF]({{< relref "dql-rdf.md" >}}) format.
1111
When using JSON format Dgraph creates nodes and relationships from the JSON structure and assigns UIDs to nodes.
1212

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+
1351
## Specifying node UIDs
1452

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:
1656

1757
```dql
1858
{
@@ -24,7 +64,8 @@ For example, if you run this mutation:
2464
]
2565
}
2666
```
27-
You will see that Dgraph responds with
67+
68+
Dgraph responds with:
2869
{{< highlight json "linenos=false,hl_lines=7 " >}}
2970
{
3071
"data": {

content/learn/data-engineer/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ weight = 3
1515
### Recommended learning path
1616
- See [Dgraph Overview]({{< relref "dgraph-overview.md" >}}) for an introduction to Dgraph database and a presentation of Dgraph cluster architecture.
1717
- Get familiar with some terms in the [Glossary]({{< relref "dgraph-glossary.md" >}}).
18-
- Follow the [Dgraph Query Language(DQL) Quickstart]({{< relref "dql/dql-get-started" >}}) to execute some queries.
18+
- Follow the [Dgraph Query Language(DQL) Quickstart]({{< relref "quick-start" >}}) to execute some queries.
1919
- Follow the [Get Started with Dgraph]({{< relref "learn/data-engineer/get-started-with-dgraph" >}}) tutorial.
2020
- Use [DQL Syntax]({{< relref "dql-query.md">}}) and [Query Language]({{< relref "_index.md" >}}) as references.
2121
- Go to [Clients]({{< relref "clients" >}}) to see how to communicate

0 commit comments

Comments
 (0)