GraphQL allows us to define a generic, UI-agnostic data model on the server using a graph schema that encodes the natural relationships within the data. To wire our model to data, we define resolvers in the schema that leverage our db's own query language (SQL, NoSQL, or Graph query language, etc) or in-memory objects to resolve client-defined, graph-oriented queries against our generic data model.
With each components in the UI component tree declaring its own data dependencies, GraphQL/Relay creates a projection of the graph data model that maps to the UI component tree, thus allowing us to have a UI-agnostic data model on the server, while at once giving us and UI-specific projection of the data. The queries from GraphQL server to the database are composed in an efficient manner based on the aggregate data dependencies that are declared by each component in the UI component