I Built "The Ontology of Madonna" with AWS Context Ontology Accelerator
Turning an album’s credits and reviews into a knowledge graph with Amazon Bedrock, Neptune and OpenSearch

Recently, AWS released the Context Ontology Accelerator, an open-source project that sets out to solve a few problems: context, entities, rules and relationships are scattered across dozens of systems that name and structure things differently, and reconciling all of that for an agent to access is a challenge. The accelerator builds a semantic layer to help with that and enable agents to make decisions that are more accurate, consistent and explainable.
It connects to your sources, works out a formal map of what exists in your data and how it all relates, builds a knowledge graph from that map and serves the result so it can be queried with its meaning intact. It runs mainly on Amazon Neptune for the graph, Amazon OpenSearch for search and Amazon Bedrock for the AI, but the accelerator provisions a whole stack of infrastructure: networking, authentication and access control, a graph database and vector search layer, a document ingestion pipeline, an ontology engine, a web front end, and the reasoning engine - deployed as around 16 separate CloudFormation stacks. Of course I had to try this amazing open-source project! :)
And what does Madonna have to do with it?
Not much to be honest, but Madonna has spent four decades reinventing herself, and each reinvention became a reference point for the artists who came after. "Confessions II", released in July 2026, is her fifteenth studio album and what caught my attention is how much of it is made of references. It is a sequel to "Confessions on a Dance Floor", it leans on classic house and dance samples, and it keeps echoing her own past. The album points outward to other artists and inward to her own catalog, all at once. That web of references is exactly the kind of thing an ontology is meant to capture: what exists and how it all connects.
And this was enough of an excuse for me to use Madonna's new album as the use case. So, read this if you're interested in understanding:
- what it takes to run AWS Context Ontology Accelerator;
- how it works in practice and how you can interact with it;
- nothing, you just think Madonna is awesome. 🪩🕺
Before we start
The first thing you should know is that there's an official documentation available . This article won't be as detailed as the docs because its intention is to show the project working with a specific use case and the results it produces.
⚠️ The second thing you should know is that Context Ontology Accelerator is meant for enterprises, and it runs on infrastructure priced for them. For my project, the cost is out of proportion to the goal: I am modeling one album to see how the tool behaves, but an enterprise would be modeling thousands of products, policies and relationships to feed AI agents making real decisions. The price is not a flaw in the tool, but a signal of the scale it expects.
My job in this article is just to be honest that I am running an enterprise-scale engine on a hobby-scale problem (on purpose).
Setting things up
A couple of prerequisites and changes I had to make in my AWS account are worth mentioning.
Bedrock foundation models
The first-time use of Anthropic models may ask you to submit your use case details before access is granted, so it is worth triggering that before deploying. For me, the easiest way to enable the models was to invoke them in the Bedrock console's Playground.
Sonnet 5 is one of the default models used. Unfortunately it is not enabled for my account, so I took the liberty to change it to
us.anthropic.claude-sonnet-4–6 in context-manager/src/coa_serve/config.py.Permissions
The official documentation recommends
AdministratorAccess for the initial deployment, which is what I used.The ECS task running the knowledge graph build had
bedrock:InvokeModel granted, but calling Cohere Embed v4 still failed with an Access Denied Exception. Third-party models on Bedrock are distributed via AWS Marketplace and invoking one requires aws-marketplace:ViewSubscriptions and aws-marketplace:Subscribe on top of the usual Bedrock permission, so I added them by hand.Lambda execution quota
I had to request an increase in my Lambda concurrent executions quota. It was set to 10, which wasn't enough to deploy the accelerator, so I had it raised to 1000, the minimum you can request.
In my case, I didn't have it approved immediately and it took a couple of hours to get a response from AWS suport.
Deploying it
After solving the issues I described in the previous section, I deployed the project by running
make deploy-dev and it took a little more than 1 hour to have all the stacks successfully created.

The Context Ontology Accelerator comes with a frontend that looks just like any “regular” product you’d find in the AWS console.
The first step to use it was creating a user directly through Cognito, using the
WebAppUrl and UserPoolId from the CloudFormation outputs. Once logged in, that user held no permissions yet. The documentation points to granting platform-admin "via the API or the web app's Permissions page". It looks like, though, granting that role requires already holding it, so I ended up invoking the Lambda behind POST /grants directly, using AWS IAM credentials instead of the app's own Cognito + Cedar authorization layer.

With
platform-admin in place, the next step was creating a namespace. This part could be done using the UI and worked as expected.

For the next steps you can do most of the things either through the UI or the APIs directly. I chose to use the UI because it was enough for my use case.
Choosing the source data

Both the album’s lyrics and the reviews written about it are copyrighted, so I never touched the lyrics and I never stored the full text of any article. Everything I collected is either a published fact or a connection that a critic stated, organized in individual markdown files.
- The backbone is the official credits, which I took from Madonna’s own site. For every track there is a list stating who wrote it, who produced it, who performed on it and so on. Credits are factual notes, so I could use them as they are, and this is the layer where some relationships are already named and consistent.
- Another layer is a “samples database”. In the music world, a sample is a piece of an existing record reused inside a new song. So, the “samples database” is essentially a catalog of which older songs some tracks in Confessions II borrow from. This information is available on the internet and is built by the community, so it won’t necessarily be listed in the official credits.
- The last layer is the press with its reviews. This is where some not-so-exact connections appear: the echoes of the artist’s older work, the nods to other artists, the references a critic notices. For this part I extracted short sentences with the connections each writer pointed out. The interesting part is each writer can express the same ideas in totally different words.
SCAN — Connecting to the sources

The documentation lists 5 ways to connect a data source, split across two source types.:
- For structured data (
DATABASE), there's JDBC (direct connections to PostgreSQL, Redshift, MySQL, SQL Server, queryable either via a native driver or through Athena federation) and Glue Data Catalog, for catalogs already registered in Glue.
- For unstructured data (
DOCUMENTS), my case, there are three: referencing an existing S3 bucket directly, uploading via the API, or uploading local files straight through the web UI.
I used the last one: from the namespace, Sources > Connect Source > Documents, I created three distinct sources and uploaded the markdown files that contained the official credits, the samples and references I extracted from reviews online.
The documentation describes the ingestion pipeline as made of four stages: preprocessing (“extracts text, splits into chunks, validates file size”), entity extraction (“identifies concepts and relationships from text”), knowledge graph build (“creates nodes/edges in Neptune”), and embedding (“vectorizes chunks for semantic search in OpenSearch”). Since the data I uploaded was small, it took from 5 to 10 minutes to have it all scanned.

I noticed there's a full pipeline for metadata enrichment when you work with
DATABASE sources. It builds a prompt from each table's existing schema, calls Bedrock to generate a description, synonyms, glossary terms, and tags, and applies the result back to the catalog.Each table and column lands in a “pending review” state, and a human steward has to approve or reject it before it counts as validated. The value is concrete: the data becomes something a non-technical user can actually search and understand, with a human checkpoint in between so nothing AI-generated gets silently taken as fact.
⚠️ As of today, these enrichment and review functionalities are not extended to
DOCUMENTS sources.
MODEL — Inducing the ontology
An ontology is a formal model of a domain: classes (
Customer , Order , Product ), properties ( Customer.email ), relationships between classes ( Customer places Order ), and constraints on top of them. It's stored as OWL/Turtle and materialized into Neptune alongside the data itself.There are three ways to get one:
- You can upload an existing ontology file directly through the web UI’s Induction page.
- You can manage it through the API (
CreateOntology,UploadOntology,StartInduction).
- Or you can induce one automatically, where the system analyzes a data source and infers classes, properties, and relationships from it using Bedrock.

A relevant feature here is grounding: while inducing, the system can check new classes against ontologies that are already loaded, either foundational ones (like FIBO) or ontologies induced in a previous run, and link matches instead of creating duplicates. Grounding needs something to align against, though, and I never loaded a foundational ontology into the namespace.
What I actually did was trigger induction against the knowledge graph built from the Confessions II documents, using the default (
ENHANCED ) grounding mode with no foundational ontology loaded. The job ran through to completion and produced a proposal.
What came back:
- 8 classes (
Person,Company,Creative-Work,Product,Event,Location,Software,Role)
- 100 concepts
- 68 datatype properties
- 81 object properties
-
foundational_grounded_countandclose_match_countboth came back 0, consistent with grounding having nothing loaded to check against.
The class list is quite generic, but the property layer gets more specific. 56 of the 81 object properties belong to
Creative-Work alone, and a good number of them are close synonyms of each other: produced_by , co_produced_by , made_with , collaboration_with , associated_with , each its own separate property rather than one relationship generalized with qualifiers.I noticed there's also no class hierarchy at all, so nothing is declared a subtype of anything else. For example, both “Danceteria” (a track) and "Confessions II" (the album) end up typed simply as
Creative-Work — there's no Song or Album subclass beneath it to capture the distinction between them. The explanation might be in the proposal's own metadata that I extracted from DynamoDB's table coa-dev-ontology-engine :
{ (...) "source_type": {"S": "UNSTRUCTURED"}, "description_mode": {"S": "schema"}, "warnings": {"L": [ {"S": "entailment stage is a pass-through in v0"}, {"S": "datatype property output may be sparse — see parent spec Task 12B"}, {"S": "class embedding index is rebuilt per run — see parent spec Task 10A"} ]}, (...)}
The entailment stage — the step that would normally derive a hierarchy and fold related properties together — isn’t wired up yet and runs as a pass-through in this version. It reads like something still in progress, though, and will likely capture these hierarchies in more detail in the future.
SERVE — Querying the graph
You can query the namespace by interacting with the Playground in the UI, making API calls on
POST /namespaces/{namespaceId}/query or connecting your agent to an MCP Server that is exposed over AgentCore Runtime. Either way, Context Ontology Accelerator uses a 3-tiered resolution strategy:- Metric Resolver — tries to match the question against a predefined metric and, if it hits, just runs that metric’s SQL.
- VKG/NL-to-SQL — attempts structured querying, either natural language translated to SPARQL or a more direct NL-to-SQL path against the catalog schema.
- Knowledge Retriever —performs vector search over entities and documents, a traversal of the Neptune graph, and a Bedrock call to synthesize an answer from what comes back.
Every query, regardless of tier, passes through a Cedar authorization check and a SQL firewall (table allowlists, column denylists, restricted metrics) before anything runs.
My own question — “how many artists are featured on Confessions II?” — had no metric definition to match and no structured schema to translate into SQL, so it almost certainly resolved through tier 3. That lines up with what came back: a prose answer citing specific source documents, not a table of query results.

The answer itself, though, had a placeholder in nearly every proper name. This happened because the system just wasn’t allowed to say names in the response: there was a Bedrock Guardrail configured to anonymize PII, including names, at the input and output boundaries of the query-answering model.
PII anonymization is deliberately scoped to that boundary and not to the ingestion pipeline, specifically so that named entities can still populate the knowledge graph without every document mentioning a person getting quarantined. So there was no issue here, this guardrail just wasn't meant for my particular use case.
Zooming out
I extracted the data from Neptune to take a closer look using visualization tools. It's remarkable that a small set of data could hold so many relationships. It just goes to show how much work goes into making music and how many people are involved in the production of an album: 295 entities and 1063 relationships, rendered as an interactive graph.

The relationships came out as specific, named connections pulled straight from the source text. Confessions II
PRODUCED BY Stuart Price, LABELED UNDER Warner Records, FEATURES Mirwais; Fragile interpolates "Music Box". Real people, real credits, real citations back to where each fact came from.Among the nodes I found one connection worth highlighting: the relationship between Madonna and the painter Jean-Michel Basquiat, which the track “Danceteria” on this album references. The two dated around 1982, when both were young and part of New York’s downtown club scene, neither of them yet aware of the mark they would leave on culture. Madonna was still working toward her first album, and Basquiat was moving into the gallery world. He died in 1988 at 27, and she went on to become one of the most influential figures in music.


The track “Danceteria” takes its name from the Danceteria nightclub, one of New York’s most important spots at the time. It was there, in the early 1980s, that Madonna met the actress Debi Mazar, a friend to this day. What began as a friendship in the club scene soon became a working relationship too: Mazar did the makeup and danced in the video for “Everybody,” Madonna’s first single in 1982, and went on to appear in multiple other music videos over the years.


Now, back to AWS Context Ontology Accelerator, I want to congratulate everyone working on this project. What shipped is a genuinely ambitious piece of infrastructure, built to survive enterprise production. It handles access policies, networking, ontology modeling, human-in-the-loop reviews, MCP servers, all packaged together. And it worked, end to end, days after launch.
As for myself, I set out to model one album and ended up learning how a project like this comes together under the hood. Not a bad trade for a fan project.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article