Sign in to Hypermode and create your workspace
hypermode.com/login
in your web browser and sign
in to Hypermode to create your account.After signing in you’ll be prompted to choose a name for your workspace.Create your graph
View your graph details
Connect the Ratel graph client
Add mutation in Ratel
View mutation results
Query for all movies
Movie
nodes as the start of the traversal using
the type(Movie)
function to define the starting point of our query traversal,
then finds any genres, directors, and characters connected to each movie.View results in JSON and graph visualization
type()
function to find the starting point of our
graph traversal. We can use more complex functions to filter by string
comparison operator, and others, however to use these function we must first
update the graph schema to create an index on the predicates we want to use in
these functions.
The function documentation specifies which kind of
index is needed for each function.
We’ll use Ratel to alter the schema to add indexes on some of the data so
queries can use term matching, filtering, and sorting.
Create an index for movie title
Movie.title
predicate. Ratel displays details about the predicate
type and indexes.Change the type to string then select index and select term for the
Movie.title
predicate, then select Update to apply the index.Create an index for movie release date
Movie.release_date
predicate.Select the Movie.release_date
predicate. Change the type to dateTime.
Select index and choose year for the index tokenizer. Click Update
to apply the index on the release-date
predicate.Query using indexes
Add reverse relationship
Movie.genre
predicate as a reverse relationship.To define a reverse relationship for the Movie.genre
predicate we’ll return to
the Schema page in Ratel, select the Movie.genre
predicate and toggle the
reverse checkbox. Then select Update to apply this schema change.Query using the reverse relationship
~
operator is used to specify a reverse relationship. To
traverse from a genre node to a movie node we use the syntax ~Movie.genre
.In this query we find all movies connected to the “Sci-Fi” genre:movies: ~Movie.genre
.