Skip to content

GraphQL API

OWLGraph automatically generates a GraphQL schema from your loaded ontology. The endpoint is available at /graphql.

When an ontology is loaded, OWLGraph generates a GraphQL schema:

OWL ConstructGraphQL Equivalent
Class with subclassesInterface
Leaf classType
rdfs:subClassOfimplements
Object propertyRelationship field
Data propertyScalar field
owl:inverseOf@hasInverse directive
owl:FunctionalPropertySingular field (not array)
# Get all dogs
query {
queryDog {
name
hasOwner { name }
}
}
# Get all animals (subsumption — returns Dogs, Cats, etc.)
query {
queryAnimal {
name
__typename
}
}
# Filter
query {
queryBook(filter: { title: { anyofterms: "Dune" } }) {
title
writtenBy { name }
}
}
mutation {
addDog(input: [{
name: "Rex"
hasOwner: { name: "Alice" }
}]) {
dog {
name
hasOwner { name }
}
}
}

Write-time materialization still applies — Rex gets ancestor types, and inverse edges are created.

POST https://YOUR-INSTANCE/graphql
Content-Type: application/json
{
"query": "{ queryDog { name } }",
"variables": {}
}

Point any GraphQL IDE (GraphiQL, Apollo Studio, Altair) at your instance’s /graphql endpoint. The schema is fully introspectable.

  • Complex class expressions are simplified to named class components
  • Property chain axioms are enforced by the materializer but not directly visible in the GraphQL schema
  • The GraphQL schema is regenerated when the ontology is reloaded