Day 21 challenge

Goal: master advanced graph data modeling concepts with DgraphTheme: context engineering week - sophisticated knowledge graph architectureTime investment: ~25 minutes
Welcome to Day 21! Yesterday you explored GraphRAG with Neo4j. Today you’ll advance to Dgraph - a distributed graph database designed for modern applications. You’ll learn sophisticated data modeling concepts and build knowledge graphs from real-world news data.

What you’ll accomplish today

  • Understand key Dgraph concepts and architecture
  • Load sample RDF data from a news article knowledge graph
  • Explore different types of knowledge graphs (lexical, domain, visual, geospatial)
  • Model complex relationships and schema design
  • Connect to the hyper-news example project for real-world data
This introduces advanced graph database concepts. You’ll work with RDF data formats and sophisticated schema design patterns that differ from traditional databases.
We’ll use the hyper-news project as our example - a news article knowledge graph that demonstrates real-world complexity using data from the New York Times API.

Understanding key Dgraph concepts

Dgraph differs from other graph databases in several important ways:

Dgraph architecture

Dgraph makes
  • Distributed by design: Automatically shards data across multiple nodes
  • ACID transactions: Full transactional consistency across the distributed system
  • GraphQL native: Direct GraphQL support without translation layers
  • Type system: Strong typing with schema validation

Core concepts

  • Predicates: Properties or relationships between nodes (similar to edges)
  • UIDs: Unique identifiers for nodes (automatically managed)
  • Facets: Properties on predicates (metadata about relationships)
  • Types: Schema definitions that group predicates
  • Indexes: Optimizations for specific query patterns

Graph data modeling

hyper-news graph data model

Step 1: Create your Hypermode Graph instance

We’ll use the hyper-news project as our example - a news article knowledge graph that demonstrates real-world complexity using data from the New York Times API.

Project structure

The hyper-news knowledge graph contains:
  • Articles: News articles with content, metadata, and relationships
  • Entities: People, organizations, locations mentioned in articles
  • Topics: Subject categories and themes
  • Sources: News outlets and publishers
  • Temporal data: Publication dates and time-based relationships

Create your Hypermode graph

1

Sign in to Hypermode

Navigate to Hypermode and sign in.
2

Create a new graph

Select the “Develop” tab and click “Create Graph”. Give your graph a name and select “Create Graph”.create new graph
3

Copy the Dgraph connection string

Copy the dgraph:// connection string, you’ll use this to connect to your Hypermode Graph instance.dgraph connection string
4

Open the Ratel interface

Navigate to ratel.hypermode.com and connect to your Hypermode Graph instance using the dgraph:// connection stringconnect to graph
5

Update the graph schema

update graph schemaSelect “Schema” from Ratel’s left navigation, then select “Bulk Edit” and copy and paste the following graph schema to replace the default schema, then select “Apply
6

Import the sample data into your graph

Load RDF data into your graph, navigate to the Ratel interface and connect to your graph using the Dgraph connection string. Then run the following mutation in Ratel (be sure to select the Mutate tab):
import sample data

Verify your graph

Run the following query in Ratel to verify your graph data is loaded:
{
  articles(func:type(Article),first:100) {
    Article.title
    Article.uri
    Article.url
    Article.published
    Article.abstract
    Article.topic {
      Topic.name
    }
    Article.org {
      Organization.name
    }
    Article.geo {
      Geo.name
    }
  }
}
querying the graph using Ratel

What you’ve accomplished

In 25 minutes, you’ve mastered advanced graph data modeling: Dgraph architecture: understood distributed graph databases and modern capabilities Real-world data modeling: worked with complex news article knowledge graphs Multi-type graphs: explored lexical, domain, visual, and geospatial graph patterns Advanced patterns: learned temporal modeling, multi-modal integration, and provenance tracking Agent integration: connected sophisticated graph capabilities to your agents

Next steps

In the next

Tomorrow - Day 22

Master DQL (Dgraph Query Language) for complex graph queries and integrate Dgraph with your agents using multiple client libraries.

Pro tip for today

Experiment with different graph modeling approaches:
Help me understand when to use different knowledge graph types:

1. For a customer support system: What type of knowledge graph would be most effective?
2. For a research assistant: How would you model academic papers and citations?
3. For a business intelligence system: What relationships matter most for competitive analysis?
4. For a content recommendation system: How do you balance multiple types of similarity?

Show me schema examples and explain the reasoning behind each design choice.
This develops intuition for choosing the right graph modeling approach for different use cases.
Time to complete: ~25 minutes
  • Skills learned Dgraph architecture, RDF data modeling, multi-type knowledge graphs, temporal and provenance patterns, agent integration strategies
Next: day 22 - DQL querying and multi-language client integration
Remember Advanced graph modeling is about representing not just what you know, but how you know it, when you knew it, and how confident you are about it. This metadata becomes crucial for agent reasoning.