liveBook · Manning

Chapter 3: Create your first knowledge graph from ontologies

What you will learn in chapter 3 of Knowledge Graphs and LLMs in Action

The introduction explains why integrating diverse data into a knowledge graph is difficult and how an ontology can provide shared meaning, using rare-disease data as the chapter’s example.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains why integrating diverse data into a knowledge graph is difficult and how an ontology can provide shared meaning, using rare-disease data as the chapter’s example.

Key terms: KG construction, data integration, information syntax, information granularity, semantic integration, ontology, reference schema, vocabulary, mapping, annotations

3.1 Knowledge graph building: Warmup

3.1.1 Business and domain understanding

This section identifies clinicians’ diagnostic needs and defines the disease and phenotype concepts that the knowledge graph must represent.

Key terms: clinician, phenotypic anomalies, diseases, sources of the connections, phenotype, phenotypic features, disease, time course, diabetes mellitus, phenotypic characteristic

3.1.2 Data understanding

This section identifies the two HPO data sources for the example knowledge graph and shows how to inspect the ontology and interpret its disease–phenotype annotations.

Key terms: Human Phenotype Ontology (HPO), hpo.owl, phenotypic anomalies, interoperability, OWL, rdflib, triples, subject, predicate, object

3.2 Understanding knowledge graph technologies

This section introduces RDF and LPG, compares how they represent relationship properties, and describes tools that bridge their differences.

Key terms: Resource Description Framework (RDF), Labeled Property Graph (LPG), triple, subject, predicate, object, named graphs, RDF*, edge-specific information, advanced semantics

3.2.1 RDF or LPG? A goal-driven discussion

This section uses the HPO ontology and clinical annotations to show how a knowledge graph technology choice should follow the available data and clinicians’ goals.

Key terms: HPO ontology, annotations data, provenance, RDF, OWL, Web Ontology Language, disease, phenotypic feature, annotation, HAS_PHENOTYPIC_FEATURE

3.2.2 Representing edge properties with RDF and LPG

The section compares ways to attach annotation metadata to a disease–phenotype relationship and explains why the book chooses LPG and Cypher for its knowledge graph.

Key terms: n-ary relations, blank node, PhenotypicAnnotation, provenance, named graphs, TriG, RDF-star, SPARQL, RDF engines, LPG

3.3 Building a knowledge graph

Introduces the two stages of building the knowledge graph and notes the tools and data version used in the examples.

3.3.1 Ontology ingestion and processing with neosemantics

This section prepares Neo4j for the HPO ontology, configures Neosemantics, loads and enriches the vocabulary, and inspects the resulting graph.

Key terms: Resource, uri, id, HpoPhenotype, HpoDisease, constraints, Neosemantics, namespaces, relationship types, LPG

3.3.2 Annotation ingestion and processing

The section explains how to integrate HPO disease–phenotype annotations into the ontology-based knowledge graph, enrich their relationships, and remove unneeded ontology content.

Key terms: HPOA, TSV, hpo.owl, phenotype.hpoa, HpoDisease, HpoPhenotype, relationship properties, FOREACH, HAS_PHENOTYPIC_FEATURE, apoc.periodic.iterate

3.4 Querying the data

Shows how a clinician can query a knowledge graph with patient phenotypic features to investigate a rare-disease diagnosis.

Key terms: KG, phenotypic features, Type 1 diabetes, Ondontochondrodysplasia 2 with hearing loss and diabetes, HPO, OMIM, phenotypic feature, disease

3.5 Reasoning over the KG

This section shows how reasoning over HPO subclass relationships can reveal disease annotations that are not directly connected to an endocrine-system abnormality.

Key terms: inference, deductive reasoning, HPO, subclasses, annotations, Neosemantics

3.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 2: Intelligent systems: A hybrid approach Chapter 4: From simple networks to multisource integration →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.