Import and reason over ontologies

An ontology describes classes, properties, and relationships such as subclass membership. Importing its asserted triples makes those facts queryable. Materialization additionally computes supported inferred facts, so queries can use relationships that follow from the ontology.

Import an ontology

You need a running server, write access to the selected database, and a Turtle, RDF/XML, or OWL file. This command uploads a local Turtle file and requests materialization:

shrikedb --server http://127.0.0.1:8182 --db YOUR_DATABASE_ID \
  ontology import --input ontology.ttl --format turtle --upload --materialize

Replace the database ID and filename. Without --upload, the path is server-local. Without --materialize, the import loads asserted facts only. See Import a dataset for the complete inspection and loading workflow.

Review the import response for counts and diagnostics. Start with a bounded ontology sample when estimating memory and runtime: inferred facts can considerably exceed the asserted input.

Inspect the imported graph

Run this through ExecuteSPARQL or a console’s SPARQL query mode:

SELECT ?child ?parent WHERE {
  ?child <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?parent .
}
LIMIT 20

Compare representative class and instance relationships with the ontology you imported. A missing result can mean that a required import is absent, the dataset uses another IRI, or the requested inference is outside the reasoner’s supported behavior. Preserve parser and materialization diagnostics when investigating.

Use ontology vocabulary in semantic queries

A semantic profile maps your dataset’s labels and relationships to domain concepts. Ontology grounding links those concepts to ontology classes or properties. The semantic compiler can then use that context to explain class membership or constrain a question.

Importing an ontology alone does not define how application fields map to it. Review those bindings in the domain profile, then validate sample questions and inspect the ontology evidence returned with each answer.

Updating an ontology

Keep the source file and version used for each import. Before replacing ontology inputs, test the new version in a separate database and compare representative query results. Changes to class hierarchies can change both inferred facts and semantic answers.

Use database backups to preserve the imported state and retain external ontology files separately for reproducibility.