Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <danscode@selman.org>
  • Loading branch information
dselman committed May 31, 2024
1 parent cb6da53 commit 3df5676
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,44 @@ concept Movie extends GraphNode {
}
```

## Graph Model

The data model for the graph (the definition of the structure of the nodes and edges) is specified
using a [Concerto model](https://concerto.accordproject.org). The nodes in the graph should extend
`GraphNode`.

Here is a very simple sample model for books: each book is related to a Genre. A book has a
`summary` property that is full-text searchable as well as searchable using a vector
similarity search.

```
@description("Ask questions about books and book genres.")
namespace test@1.0.0
import org.accordproject.graph@1.0.0.{GraphNode}
@questions("How many books genres do we have?")
concept Genre extends GraphNode {
}
@questions("How many books do we have?")
concept Book extends GraphNode {
o Double[] embedding optional
@vector_index("embedding", 1536, "COSINE")
@fulltext_index
o String summary optional
@label("IN_GENRE")
--> Genre[] genres optional
}
```

### Decorators

1. `@description` is placed on the namespace and describes the general types of questions that can be asked of this model
2. `@vector_index` is placed on `String` properties to make them vector similarity searchable. The first argument to the decorator specifies the name of a property of type `Double[]` that is used to store the vector embeddings for the text in the `String` property
3. `@fulltext_index` is placed on `String` properties to make them fulltext searchable
4. `@label` is placed on relationships `-->` to indicate the type of an edge
5. `@questions` is placed on concepts that extend `GraphNode` to supply sample questions that can be asked about this type of node

## Install

```bash
Expand Down

0 comments on commit 3df5676

Please sign in to comment.