The Graph is an indexing protocol which helps dapps and everyone else to query data faster and indexing the data.
So how does this Graph work?
It works in the following way since Graph will work in the EThereum network in the starting stages.
The Graph understands what data to index in the chain from the subgraph manifest. This subgraph manifest is run on an IPFS solution using the Graph CLI.
This is the overall architecture of The Graph.
Now let’s talk about subgraph, what it is made up of?
The Subgraph-Definition consists of the following three elements :
- A yaml file
- A graphQL schema
- Assembly script
Now we will be discussing in detail about GraphQL :
The Graph QL is an open-source data query language developed by Facebook in 2015.
The GraphQL series is created by defining the types and fields of those types.
type Query {
me: User
}
type User {
id: ID
name: String
}
GraphQL isn’t tied to any specific database and is backed by your existing code and data.
function Query_me(request) {
return request.auth.user;
}
function User_name(user) {
return user.getName();
}
This is a basic example of Graph QL its something similar to JSON or TYPESCRIPT nothing very new for any developer.