Skip to main content

Querying with SPARQL

SPARQL is to a graph what SQL is to tables. If you can write a SELECT with joins, you can write SPARQL. The shape is SELECT ?vars WHERE { pattern }, where the pattern is a set of subject–predicate–object triples that share variables.

Where to Run Queries

Glossary-scoped SPARQL runs against the database-primary glossary model, it works with RDF storage off, and cannot reach other assets, external datasets, or SERVICE endpoints. Catalog-wide SPARQL runs against the triple store and is admin-only.

Named Graphs

Always scope instance-data queries to the knowledge graph. Ontology and shapes triples live elsewhere, so an unscoped ?s ?p ?o returns schema noise.

Prefixes

The console pre-populates these; include them in API calls yourself.

The Vocabulary You Will Use Most

Entity IRIs follow https://open-metadata.org/entity/{entityType}/{uuid}.
Discover the schema instead of guessing it. GET /api/v1/rdf/ontology returns the full ontology; the MCP tool ontology_describe does the same for agents and accepts a resource URI for a focused DESCRIBE. Reading the actual class and property declarations beats guessing predicate names, for you and for an LLM.

Limits

Every read runs behind an admission guard: Writes (INSERT, DELETE, DROP, LOAD, CLEAR, CREATE) are rejected on the read endpoints. POST /api/v1/rdf/sparql/update exists for admins, but see the warning below. Federation (SERVICE clauses to external endpoints) is disabled by default. When enabled, target URIs must appear verbatim in an allowlist, trailing slashes matter.
Do not use SPARQL UPDATE to change your catalog. The graph is a derived index; the next reindex discards anything written directly. Write through the entity APIs.

Cookbook

Discovery

Governance

Lineage

prov:wasDerivedFrom+ is a property path, SPARQL’s transitive traversal operator. It is the single feature that makes graph queries worth the switch, and it has no clean SQL equivalent. If you enable the transitive lineage closure inference rule, the closure is materialized and you can drop the +.

The Ontology, Applied

Structure

Calling the API

Result formats: json (default), xml, csv, tsv for SELECT/ASK; turtle, jsonld, ntriples, rdfxml for CONSTRUCT/DESCRIBE.

Performance Notes

  • Always scope to the named graph. Unscoped patterns scan schema and shapes as well.
  • LIMIT early. The guard truncates you at 1,000 rows by default anyway; be explicit.
  • Bind the most selective triple first. Start from a specific IRI or an indexed literal like om:fullyQualifiedName, not from ?s a om:Table.
  • Property paths are powerful and expensive. + and * over a large lineage graph can hit the 30-second timeout. If you run one regularly, materialize it as an inference rule instead.
  • Prefer FILTER NOT EXISTS over OPTIONAL + !BOUND. Same result, better plan.

Next

Reasoning & Validation

Materialize the closures you keep re-computing.

Graph Insights

Pre-computed importance, communities, and paths.