Skip to content

Loading Ontologies

Terminal window
curl -X POST http://localhost:8080/ontology \
-H "Content-Type: text/turtle" \
--data-binary @your-ontology.ttl

This single request parses, validates, compiles, applies the schema, persists the ontology, initializes the reasoning engine, and triggers retroactive materialization.

Terminal window
# Load an ontology into a running cluster
dgraph ontology load your-ontology.ttl --alpha http://localhost:8080
# Validate without applying
dgraph ontology validate your-ontology.ttl --alpha http://localhost:8080

Test your ontology without side effects:

Terminal window
curl -X POST "http://localhost:8080/ontology?validate=true" \
-H "Content-Type: text/turtle" \
--data-binary @your-ontology.ttl

Returns the compiled schema and any validation errors without applying changes.

  • Turtle syntax — valid Turtle format
  • OWL2 RL compliance — all constructs within the RL profile
  • Circular subclass detection — A subClassOf B subClassOf A is rejected
  • Conflicting characteristics — a property can’t be both symmetric and asymmetric
  • Undefined references — domain/range referencing non-existent classes

The raw Turtle data is stored in the database as an OWLGraphMeta node. On Alpha restart, the ontology is automatically reloaded — no manual intervention needed.

Loading a new ontology replaces the current one. The process:

  1. New ontology is parsed and validated
  2. New schema is compiled and applied
  3. Old reasoning engine is replaced with new one
  4. Retroactive materialization runs for existing data

Caution: Ontology updates can trigger significant retroactive materialization if the class hierarchy changes. Test updates in a staging environment first.

  • Validate first — always use ?validate=true before applying to production
  • Version your ontologies — keep ontology files in version control
  • Start simple — begin with core classes, add complexity incrementally
  • Test with data — load sample data and run queries to verify behavior