Data Models

Index Network uses different type of models to store information on Ceramic Network and provide interoperability on them. There are 3 base models directly integrated and ready to use.

Base Data Models

These models provides solid infrastructure for the composability and semantic needs of the projects.

ModelStream ID

Index

kjzl6hvfrbw6c6wr91bqjojw1znltqso445kevew3hiywjl1ior4fga60arj9xo

IndexItem

kjzl6hvfrbw6c66p7dxhk35uass66v2q42b2sdbaw7smitphfv60y9tux4obxu4

Embedding

kjzl6hvfrbw6c5wx4eb9mmw2su1q7y4m65wd8m887ulubbfn5iawpy6ukprq4va

Rrepresents a collection of items around a specific context, acting as a structured way to organize and access related information. Index includes fields for a title, a signer's public key, and timestamps for creation, updates, and deletion. The inclusion of signerPublicKey and signerFunction specifies the use of decentralized access control mechanism through Lit Protocol, which enables secure access based on cryptographic conditions.

Establishes a relationship between an index and its nodes within a graph, essentially linking the metadata or content stored in an index to individual data points or nodes. Each IndexItem is associated with a specific Index and a Node on ComposeDB, tracked by their respective IDs, and it includes timestamps for creation, updates, and deletion. This model facilitates navigating from an abstract index to concrete items or nodes, making it a crucial component for organizing and retrieving data in a structured manner within a decentralized context.

The Embedding model is focused on storing vector embeddings for items within an index, where each embedding represents high-dimensional data reduced to vectors for efficient similarity searches or machine learning applications. It includes a model name, the vector itself, optional context, description, category, and links to the related Index and Node. Very soon, the embedding model will facilitate the interoperability of vector embeddings to enable exchange of semantic information across various AI models.

Using Custom Schemas

If you want to use your own schema, you can do so by creating and deploying a custom model. Below are the methods and examples of how to use them.

Creating a Custom Model

Use the createModel method to create a custom model using a GraphQL schema.


const modelResponse = await indexClient.createModel(`
  type CustomObject {
    title: String! @string(maxLength: 50)
  }

  type YourModel @createModel(accountRelation: LIST, description: "Full schema for models") {
    id: ID!
    booleanValue: Boolean!
    intValue: Int!
    floatValue: Float!
    did: DID!
  }
`);

Deploying a Custom Model

After creating a custom model, use the deployModel method to deploy it.

await indexClient.deployModel(modelResponse.models[0]);

Last updated