github.com/cayleygraph/cayley@v0.7.7/docs/getting-started.md (about)

     1  # Getting Started
     2  
     3  This guide will take you through starting a graph based on provided data.
     4  
     5  ## Prerequisites
     6  
     7  This tutorial requires you to be connected to **local Cayley installation**. For more information on installing Cayley locally, see [Install Cayley](https://github.com/cayleygraph/cayley/tree/06f7114d4ad1725d58f16fc5fdc9394f293c3539/docs/installation.md).
     8  
     9  ## Start Cayley
    10  
    11  ```bash
    12  cayley http
    13  ```
    14  
    15  You should see:
    16  
    17  ```text
    18  Cayley version: 0.7.5 (dev snapshot)
    19  using backend "memstore"
    20  listening on 127.0.0.1:64210, web interface at http://127.0.0.1:64210
    21  ```
    22  
    23  You can now open the web-interface on: [localhost:64210](http://localhost:64210/).
    24  
    25  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](configuration.md) or run `cayley http --help`.
    26  
    27  For more information about the UI see: [UI Overview](ui-overview.md)
    28  
    29  ## Run with sample data
    30  
    31  ### Download sample data
    32  
    33  [Sample Data](https://github.com/cayleygraph/cayley/raw/master/data/30kmoviedata.nq.gz)
    34  
    35  ### Run Cayley
    36  
    37  ```bash
    38  cayley http --load 30kmoviedata.nq.gz
    39  ```
    40  
    41  ## Query Data
    42  
    43  Using the 30kmoviedata.nq dataset from above, let's walk through some simple queries:
    44  
    45  ### Query all vertices in the graph
    46  
    47  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.
    48  
    49  ```javascript
    50  g.V().getLimit(5);
    51  ```
    52  
    53  ### Match a property of a vertex
    54  
    55  Find vertex with property "Humphrey Bogart"
    56  
    57  ```javascript
    58  g.V()
    59    .has("<name>", "Humphrey Bogart")
    60    .all();
    61  ```
    62  
    63  You may start to notice a pattern here: with Gizmo, the query lines tend to:
    64  
    65  Start somewhere in the graph \| Follow a path \| Run the query with "all" or "getLimit"
    66  
    67  ### Match a complex path
    68  
    69  Get the list of actors in the film
    70  
    71  ```javascript
    72  g.V()
    73    .has("<name>", "Casablanca")
    74    .out("</film/film/starring>")
    75    .out("</film/performance/actor>")
    76    .out("<name>")
    77    .all();
    78  ```
    79  
    80  ### Match
    81  
    82  This is starting to get long. Let's use a Morphism, a pre-defined path stored in a variable, as our linkage
    83  
    84  ```javascript
    85  var filmToActor = g
    86    .Morphism()
    87    .out("</film/film/starring>")
    88    .out("</film/performance/actor>");
    89  
    90  g.V()
    91    .has("<name>", "Casablanca")
    92    .follow(filmToActor)
    93    .out("<name>")
    94    .all();
    95  ```
    96  
    97  To learn more about querying see [Gizmo Documentation](gizmoapi.md)
    98