Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dgraph
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
dgraph
Commits
dc732505
Commit
dc732505
authored
9 years ago
by
Manish R Jain
Browse files
Options
Downloads
Patches
Plain Diff
Quick trial via docker. Section on Mutations.
parent
d69b6847
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+45
-13
45 additions, 13 deletions
README.md
with
45 additions
and
13 deletions
README.md
+
45
−
13
View file @
dc732505
...
...
@@ -15,6 +15,10 @@ DGraph supports [GraphQL](http://graphql.org/) as query language, and responds i
*Check out [the demo at dgraph.io](http://dgraph.io).*
`Mar 2016 - Branch v0.2`
This is the first truly distributed version of DGraph.
Please see the
[
release notes here
](
https://github.com/dgraph-io/dgraph/wiki/DGraph-v0.2-Release
)
.
`MVP launch - Dec 2015 - Branch v0.1`
This is a minimum viable product, alpha release of DGraph.
**It's not meant for production use.**
This version is not distributed and support for GraphQL is partial.
...
...
@@ -29,30 +33,58 @@ See the [query section below](#querying) for a sample query.
`curl dgraph.xyz/query -XPOST -d '{}'`
#
Installation
#
Quick Testing
## Via Docker
There's a docker image that you can readily use.
There's a docker image that you can readily use
for playing with DGraph
.
```
$ docker pull dgraph/dgraph:latest
$ docker run -t -i -v /somedir:/dgraph -v $HOME/go/src/github.com/dgraph-io/benchmarks/data:/data -p 80:8080 dgraph/dgraph:latest
# Setting a `somedir` volume on the host will persist your data.
$ docker run -t -i -v /somedir:/dgraph -p 80:8080 dgraph/dgraph:latest
```
Once into the dgraph container, you can now load your data. See
[
Data Loading
](
#data-loading
)
below.
Also, you can skip this step, if you just want to play with DGraph. See
[
Use Freebase Film data
](
#use-freebase-film-data
)
.
```
$ loader --postings /dgraph/p --rdfgzips /data/rdf-data.gzip --stw_ram_mb 3000
```
Once done, you can start the server
You that you're within the Docker instance, you can start the server.
```
$ mkdir /dgraph/m
# Ensure mutations directory exists.
$ server --
posting
s /dgraph/
p
--
mutation
s /dgraph/
m
--
stw_ram_mb 3000
$ mkdir /dgraph/m # Ensure mutations directory exists.
$ server --
mutation
s /dgraph/
m
--
posting
s /dgraph/
p
--
uids /dgraph/u
```
There are some more options that you can change. Run
`server --help`
to look at them.
Now you c
an query the server, like so:
Run some mutations
an
d
query the server, like so:
```
$ curl localhost:8080/query -XPOST -d '{root(_xid_: g.11b7nwjrxk) {type.object.name.en}}'
# Make Alice follow Bob, and give them names.
$ curl localhost:80/query -X POST -d $'mutation { set {<alice> <follows> <bob> . \n <alice> <name> "Alice" . \n <bob> <name> "Bob" . }}'
# Now run a query to find all the people Alice follows 2 levels deep. The query would only result in 1 connection, Alice to Bob.
$ curl localhost:80/query -X POST -d '{me(_xid_: alice) { name _xid_ follows { name _xid_ follows {name _xid_ } } }}'
# Make Bob follow Greg.
$ curl localhost:80/query -X POST -d $'mutation { set {<bob> <follows> <greg> . \n <greg> <name> "Greg" .}}'
# The same query as above now would now show 2 connections, one from Alice to Bob, another from Bob to Greg.
$ curl localhost:80/query -X POST -d '{me(_xid_: alice) { name _xid_ follows { name _xid_ follows {name _xid_ } } }}'
```
Note how we can retrieve XIDs by using
`_xid_`
identifier.
## Mutations
Note that the mutation syntax uses
[
RDF NQuad format
](
https://www.w3.org/TR/n-quads/
)
.
mutation {
set {
<subject>
<predicate>
<objectid>
.
<subject>
<predicate>
"Object Value" .
<subject>
<predicate>
"объект"@ru .
_uid_:0xabcdef
<predicate>
<objectid>
.
}
}
You can batch multiple mutations in a single GraphQL query.
DGraph would assume that any data in
`<>`
is an external id (XID),
and it would retrieve or assign unique internal ids (UID) automatically for these.
You can also directly specify the UID like so:
`_uid_: 0xhexval`
or
`_uid_: intval`
.
Note that a
`delete`
operation isn't supported yet.
# Installation
## Directly on host machine
Best way to do this is to refer to
[
Dockerfile
](
Dockerfile
)
, which has the most complete
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment