liveBook · Manning

Schema

As explained in Graph Neural Networks in Action

A schema is a formal specification of the classes, attributes, relationships, constraints, and other structure permitted in a data model.

A graph schema specifies the structure and rules a graph dataset should follow: which entities become nodes, which relationships become edges, what properties they carry, and what constraints apply. Decide this before transforming raw data. The same real-world data can support several graph structures, and that choice shapes the queries and graph-learning tasks the data can support. section 8.2 section 8.3.1

Build and check a schema in a short cycle:

  • Start with the domain and use case. Identify the entities, relationships, features, and constraints needed for the intended analysis. section 8.2
  • Choose a structure. A simple graph may have one node type and one edge type; a heterogeneous graph may need several of each. An entity-relationship diagram can make relationships and constraints visible. section 8.2.2
  • Create an instance model from a subset of real data. Give nodes identifiers, labels, and properties; give edges their relationships, directions, and properties. Check that the instance obeys the schema. section 8.2.3
  • Visualize and query the instance, then revise the schema where the structure fails to represent the data or support the intended questions. section 8.2.3 section 8.5

Recruitment data

For a recruitment pipeline, first decide where candidates and their relationships belong in the graph. Then populate a small instance with actual candidate data rather than placeholders. Testing that instance can expose missing features or unsuitable relationships before the full dataset enters the pipeline. section 8.2 section 8.2.3

At left is the relationship nomenclature for ER diagrams. At right is an example of a conceptual schema using an ER diagram.
sidebar figure

The entity-relationship diagram shows how a conceptual schema can communicate entities, relationships, and constraints before data is populated. section 8.2.2

An explicit schema helps test data integrity, compare alternative graph structures, and avoid technical debt. It also guides extraction and preprocessing when the source is not already a graph. Published datasets can provide a starting point, but some omit an explicit schema; their entities, relationships, and constraints may have to be inferred by querying the data. Settle the schema alongside the data model before choosing a transfer format or a representation such as an edge list. section 8.2.2 section 8.4 section 8.3.1

How Graph Neural Networks in Action covers it

How deep it goes
Develops schema design through instance-model construction, validation, and refactoring, without prescribing a database-specific schema language.
Examples
Uses recruitment data, progressively varied node-and-edge schemas, and an instance model populated with candidate data.
What it assumes
Introduces graph datasets and instance models while working from the basic elements of nodes, edges, and features.
What you can do after
Build it from scratch by defining graph structure, testing a populated instance, and refactoring the schema before downstream analysis.
How it connects
Connects graph datasets, entity-relationship diagrams, instance models, heterogeneous graphs, ETL, and GNN pipelines.

Also explained in

Compare how 44 books explain schema →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Neural Networks in Action. The section links point to the parts of the book it draws on.