Overview
A knowledge graph encodes structured facts as triples: (subject, relation, object). "Aspirin inhibits COX-2." "TP53 activates apoptosis." "Graphene exhibits high conductivity." Each triple is an edge in a vast relational graph, and the graph as a whole represents a machine-readable map of what we know about a scientific domain. The discovery question is: what edges are missing? If we can predict which triples are plausible but absent, we have a systematic engine for generating scientific hypotheses.
This chapter teaches three layers of that prediction engine. First, knowledge graph embedding models (TransE, RotatE, ComplEx) learn vector representations of entities and relations such that the geometry of the embedding space encodes the plausibility of any triple. Second, graph neural networks refine these representations by passing messages along the graph structure, aggregating neighborhood context to predict missing links. Third, we assemble a complete pipeline: extracting relations from scientific papers, embedding them with RotatE, scoring candidate links, and surfacing the highest-scoring missing connections as discovery hypotheses.
Knowledge representation was introduced abstractly in Chapter 3. The representation learning techniques from Chapter 26 provide the mathematical foundation for embedding entities into continuous spaces. The literature mining pipeline from Chapter 36 supplies the raw relation triples that populate our graph. And the hypotheses we generate here feed directly into Chapter 39: Hypothesis Generation, where link predictions become testable scientific claims.
Prerequisites
Readers should be comfortable with the representation learning concepts from Chapter 26 (embedding spaces, contrastive objectives, evaluation metrics) and the relation extraction techniques from Chapter 36: Literature Mining. Familiarity with basic graph theory (nodes, edges, adjacency matrices) is assumed; see Appendix A for a refresher. The code examples use PyTorch, PyTorch Geometric (PyG), and NetworkX; installation instructions are in Appendix B.
Learning Outcomes
- Formulate link prediction as a scoring problem over (head, relation, tail) triples and implement TransE, RotatE, and ComplEx scoring functions.
- Train knowledge graph embeddings on scientific relation data and evaluate them with Mean Reciprocal Rank (MRR) and Hits@k metrics.
- Implement GNN message passing (R-GCN) for knowledge graph completion and compare its performance against embedding-only baselines.
- Build a scientific knowledge graph from extracted paper relations using Neo4j, NetworkX, and RDFLib.
- Deploy a RotatE link prediction pipeline to surface missing relations as ranked discovery hypotheses.
- Integrate knowledge graph discovery into the Discovery Workbench for iterative hypothesis refinement.
Sections
38.1 Link Prediction and Graph Embeddings
Knowledge graph embedding models: TransE (translation), RotatE (rotation), ComplEx (complex-valued). Scoring functions, negative sampling, and training. MRR and Hits@k evaluation. Scientific relation types: causes, inhibits, activates, binds.
38.2 GNNs for Knowledge Completion
Message passing on relational graphs. R-GCN for multi-relational data. Neighborhood aggregation as implicit link prediction. Combining GNN encoders with embedding decoders. Scalability to million-node scientific graphs.
38.3 Building a Scientific Knowledge Graph
End-to-end recipe: relation extraction from papers, graph construction with Neo4j and NetworkX, RotatE training with PyKEEN, link prediction scoring, and hypothesis ranking. The Discovery Workbench KG module.
Bibliography
Foundational Papers
Introduced TransE, the translation-based embedding model that treats relations as translations in vector space. The simplicity and effectiveness of TransE established knowledge graph embeddings as a field.
Proposed modeling relations as rotations in complex vector space, enabling RotatE to capture symmetry, antisymmetry, inversion, and composition patterns that TransE cannot represent.
Introduced ComplEx, which uses complex-valued embeddings and the Hermitian dot product to model asymmetric relations, achieving strong results on standard benchmarks.
Proposed R-GCN, extending graph convolutional networks to multi-relational data with relation-specific weight matrices and basis decomposition for parameter efficiency.
Scientific Knowledge Graphs
Built Hetionet, a heterogeneous biomedical knowledge graph with 47,031 nodes and 2,250,197 edges, demonstrating systematic drug repurposing through network-based link prediction.
The premier curated database of drug-target interactions, providing gold-standard relation triples for training and evaluating biomedical link prediction models.
Tools & Libraries
A comprehensive library for training TransE, RotatE, ComplEx, and 30+ other KG embedding models with standardized evaluation, used throughout this chapter's code examples.
PyTorch Geometric provides efficient message passing implementations for R-GCN and other graph neural networks used in Section 38.2.
The leading graph database for storing and querying knowledge graphs at scale, used in the end-to-end pipeline in Section 38.3.
Python library for graph analysis and visualization, used for knowledge graph construction and exploratory analysis before scaling to Neo4j.
Provides RDF graph construction and SPARQL query support, enabling interoperability with semantic web standards for scientific knowledge representation.
Surveys
A comprehensive benchmark of 21 KG embedding models on 4 datasets with standardized evaluation, providing the empirical grounding for the model comparisons in this chapter.