GraphQL API
OWLGraph automatically generates a GraphQL schema from your loaded ontology. The endpoint is available at /graphql.
Schema Generation
Section titled “Schema Generation”When an ontology is loaded, OWLGraph generates a GraphQL schema:
| OWL Construct | GraphQL Equivalent |
|---|---|
| Class with subclasses | Interface |
| Leaf class | Type |
rdfs:subClassOf | implements |
| Object property | Relationship field |
| Data property | Scalar field |
owl:inverseOf | @hasInverse directive |
owl:FunctionalProperty | Singular field (not array) |
Queries
Section titled “Queries”# Get all dogsquery { queryDog { name hasOwner { name } }}
# Get all animals (subsumption — returns Dogs, Cats, etc.)query { queryAnimal { name __typename }}
# Filterquery { queryBook(filter: { title: { anyofterms: "Dune" } }) { title writtenBy { name } }}Mutations
Section titled “Mutations”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.
Endpoint
Section titled “Endpoint”POST https://YOUR-INSTANCE/graphqlContent-Type: application/json
{ "query": "{ queryDog { name } }", "variables": {}}Exploring the Schema
Section titled “Exploring the Schema”Point any GraphQL IDE (GraphiQL, Apollo Studio, Altair) at your instance’s /graphql endpoint. The schema is fully introspectable.
Limitations
Section titled “Limitations”- 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