Skip to content

Commit

Permalink
docs: Update type system examples. (#4041)
Browse files Browse the repository at this point in the history
Type system schema changes required by #4017.
  • Loading branch information
MichelDiz authored and danielmai committed Sep 24, 2019
1 parent 0f9b5ba commit 3621e1a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 25 deletions.
22 changes: 11 additions & 11 deletions wiki/content/clients/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,23 +319,23 @@ op.Schema = `
dob: datetime .
type Person {
name: string
age: int
dob: string
married: bool
raw: string
friends: [Person]
loc: [Loc]
school: [Institution]
name
age
dob
married
raw
friends
loc
school
}
type Loc {
type: string
coords: float
type
coords
}
type Institution {
name: string
name
}
`
Expand Down
24 changes: 24 additions & 0 deletions wiki/content/get-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,17 @@ curl -H "Content-Type: application/rdf" localhost:8080/mutate?commitNow=true -XP
{
set {
_:luke <name> "Luke Skywalker" .
_:luke <dgraph.type> "Person" .
_:leia <name> "Princess Leia" .
_:leia <dgraph.type> "Person" .
_:han <name> "Han Solo" .
_:han <dgraph.type> "Person" .
_:lucas <name> "George Lucas" .
_:lucas <dgraph.type> "Person" .
_:irvin <name> "Irvin Kernshner" .
_:irvin <dgraph.type> "Person" .
_:richard <name> "Richard Marquand" .
_:richard <dgraph.type> "Person" .
_:sw1 <name> "Star Wars: Episode IV - A New Hope" .
_:sw1 <release_date> "1977-05-25" .
Expand All @@ -229,6 +235,7 @@ curl -H "Content-Type: application/rdf" localhost:8080/mutate?commitNow=true -XP
_:sw1 <starring> _:leia .
_:sw1 <starring> _:han .
_:sw1 <director> _:lucas .
_:sw1 <dgraph.type> "Film" .
_:sw2 <name> "Star Wars: Episode V - The Empire Strikes Back" .
_:sw2 <release_date> "1980-05-21" .
Expand All @@ -238,6 +245,7 @@ curl -H "Content-Type: application/rdf" localhost:8080/mutate?commitNow=true -XP
_:sw2 <starring> _:leia .
_:sw2 <starring> _:han .
_:sw2 <director> _:irvin .
_:sw2 <dgraph.type> "Film" .
_:sw3 <name> "Star Wars: Episode VI - Return of the Jedi" .
_:sw3 <release_date> "1983-05-25" .
Expand All @@ -247,11 +255,13 @@ curl -H "Content-Type: application/rdf" localhost:8080/mutate?commitNow=true -XP
_:sw3 <starring> _:leia .
_:sw3 <starring> _:han .
_:sw3 <director> _:richard .
_:sw3 <dgraph.type> "Film" .
_:st1 <name> "Star Trek: The Motion Picture" .
_:st1 <release_date> "1979-12-07" .
_:st1 <revenue> "139000000" .
_:st1 <running_time> "132" .
_:st1 <dgraph.type> "Film" .
}
}
' | python -m json.tool | less
Expand All @@ -270,6 +280,20 @@ curl localhost:8080/alter -XPOST -d $'
release_date: datetime @index(year) .
revenue: float .
running_time: int .
type Person {
name
}
type Film {
name
release_date
revenue
running_time
starring
director
}
' | python -m json.tool | less
```

Expand Down
4 changes: 2 additions & 2 deletions wiki/content/howto/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,8 @@ To make it work again, add a type definition via the alter endpoint. Let’s ass

```text
type Person {
name: string
age: int
name
age
}
```

Expand Down
24 changes: 12 additions & 12 deletions wiki/content/query-language/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1815,14 +1815,14 @@ the following definitions:

```
type Animal {
name: string
species: uid
dob: datetime
name
species
dob
}
type Pet {
owner: uid
veterinarian: uid
owner
veterinarian
}
```

Expand Down Expand Up @@ -2375,11 +2375,11 @@ Types are defined using a GraphQL-like syntax. For example:

```
type Student {
name: string
dob: datetime
home_address: string
year: int
friends: [uid]
name
dob
home_address
year
friends
}
```

Expand Down Expand Up @@ -2407,11 +2407,11 @@ different.

```
type Student {
student_name: string
student_name
}
type Textbook {
textbook_name: string
textbook_name
}
student_name: string @index(exact) .
Expand Down

0 comments on commit 3621e1a

Please sign in to comment.