Getting Started¶
Start a registry network, publish a small graph and query it.
Prerequisites¶
- Docker with Compose
- The repository, with a shell in its
srcdirectory - An origin that stores the files you publish. The storage stack in
src/storageprovides one. Any service that implements the same upload API works.
1. Start the registry network¶
support/registries/deploy/scripts/up.sh
This starts three relays, three indexers and a watchdog on a Docker network called registries.
2. Start an origin¶
The origin holds file bytes. For a local trial, run the storage image's origin command on the same network:
docker build -t storage-go:dev storage/go
export ORIGIN_TOKEN="$(openssl rand -hex 24)"
mkdir -p /tmp/graph-origin
docker run -d --rm --name graph-origin --network registries \
--user "$(id -u):$(id -g)" -v /tmp/graph-origin:/data \
-e ORIGIN_TOKEN storage-go:dev origin
export ORIGIN_URL=http://graph-origin:8080
export ORIGIN_PUBLIC_URL=http://graph-origin:8080
3. Write a segment¶
Create social.graph.jsonl. The .graph.jsonl ending is what marks a file as graph data.
{"node":"agent:ann","labels":["Agent"],"props":{"name":"Ann"}}
{"node":"agent:bob","labels":["Agent"],"props":{"name":"Bob"}}
{"node":"agent:cat","labels":["Agent"],"props":{"name":"Cat"}}
{"edge":"FOLLOWS","from":"agent:ann","to":"agent:bob","props":{"since":2024}}
{"edge":"FOLLOWS","from":"agent:bob","to":"agent:cat","props":{"since":2025}}
4. Publish it¶
Run this in the directory that contains the file. The first command creates your key file, registry.key, and prints your public key.
R="-relay ws://registry-relay-0:8080 -relay ws://registry-relay-1:8080 -relay ws://registry-relay-2:8080"
/path/to/src/support/registries/deploy/scripts/ctl.sh whoami
/path/to/src/support/registries/deploy/scripts/ctl.sh publish -registry social/main $R -ack 2 -file social.graph.jsonl
Note
relay authentication failed warnings with an empty reason can appear while publishing. They mean the connection closed before optional authentication finished. The command reports real failures by exiting with an error.
Keep registry.key and the state file social_main.registry.json. You need both to publish the next version.
5. Start DataGraph¶
export GRAPHS="<your public key>/social/main"
/path/to/src/data-graph/deploy/scripts/up.sh
After one synchronization interval (15 seconds by default) the graph is loaded:
curl -s http://127.0.0.1:7860/v1/graphs
6. Query it¶
G=/path/to/src/data-graph/deploy/scripts/ctl.sh
$G query -q "MATCH (a:Agent)-[p:FOLLOWS*1..3]->(b) WHERE a.name = 'Ann' RETURN b.name, length(p) ORDER BY length(p)"
The result in the verified answer is:
{"columns":["b.name","length(p)"],"rows":[["Bob",1],["Cat",2]],"truncated":false}
Find a path, prove a statement and audit the service:
$G get -op path -arg from=agent:ann -arg to=agent:cat
$G get -op proof -graph "$GRAPHS" -arg id=agent:bob
$G audit -graph "$GRAPHS" $R
audit rebuilds the graph from the registry and prints "match":true when the service's root equals yours.
7. Clean up¶
/path/to/src/data-graph/deploy/scripts/down.sh
docker stop graph-origin
/path/to/src/support/registries/deploy/scripts/down.sh
down.sh keeps keys and data. purge.sh --yes deletes them permanently.