Cayley
Search…
Getting Started
This guide will take you through starting a graph based on provided data.

Prerequisites

This tutorial requires you to be connected to local Cayley installation. For more information on installing Cayley locally, see Install Cayley.

Start Cayley

1
cayley http
Copied!
You should see:
1
Cayley version: 0.7.7 (dev snapshot)
2
using backend "memstore"
3
listening on 127.0.0.1:64210, web interface at http://127.0.0.1:64210
Copied!
You can now open the web-interface on: localhost:64210.
Cayley is configured by default to run in memory (That's what backend memstore means). To change the configuration see the documentation for Configuration File or run cayley http --help.
For more information about the UI see: UI Overview

Run with sample data

Download sample data

Run Cayley

1
cayley http --load 30kmoviedata.nq.gz
Copied!

Query Data

Using the 30kmoviedata.nq dataset from above, let's walk through some simple queries:

Query all vertices in the graph

To select all vertices in the graph call, limit to 5 first results. g and V are synonyms for graph and Vertex respectively, as they are quite common.
1
g.V().getLimit(5);
Copied!

Match a property of a vertex

Find vertex with property "Humphrey Bogart"
1
g.V()
2
.has("<name>", "Humphrey Bogart")
3
.all();
Copied!
You may start to notice a pattern here: with Gizmo, the query lines tend to:
Start somewhere in the graph | Follow a path | Run the query with "all" or "getLimit"

Match a complex path

Get the list of actors in the film
1
g.V()
2
.has("<name>", "Casablanca")
3
.out("</film/film/starring>")
4
.out("</film/performance/actor>")
5
.out("<name>")
6
.all();
Copied!

Match

This is starting to get long. Let's use a Morphism, a pre-defined path stored in a variable, as our linkage
1
var filmToActor = g
2
.Morphism()
3
.out("</film/film/starring>")
4
.out("</film/performance/actor>");
5
6
g.V()
7
.has("<name>", "Casablanca")
8
.follow(filmToActor)
9
.out("<name>")
10
.all();
Copied!
To learn more about querying see Gizmo Documentation
Last modified 1yr ago