OWL API Interfaces
OWL makes it possible to describe a domain in terms of classes, properties and individuals. Classes represent collections of objects which usually share some common characteristics. Properties represent binary relationships i.e. relationships between two things. Properties can be divided into object properties and data properties. Object properties represent binary relationships between two individuals (objects), while data properties represent binary relationships between individuals and data values (constants). Finally, individuals represent single objects in the domain.
The OWL API views an ontology as a collection of facts/statements about the classes, properties and individuals in a domain. These facts/statements are known as axioms. Some examples of axioms are: subclass axioms, which state one class is a subclass axioms; class assertion axioms, which state that an individual is an instances of a class; property assertion axioms, which state that an individual is related to another individual or constant by a property; property characteristic axioms which specify the characteristics of a property, e.g. whether it is symmetric, transitive etc. The OWL API has many types of axioms, which correspond to the OWL axioms which are laid out in the OWL 2 specification.
Generally speaking, OWL API interfaces can roughly be divided into four categories: 1) Interfaces to represent entities such as classes, properties and individuals, 2) Interfaces to represent class descriptions (named and anonymous classes), 3) Interfaces to represent axioms, which state something about classes, properties and individuals, 4) Interfaces for management such as loading and managing ontologies.
At the heart of the API is the OWLOntologyManager interface. This has methods, for loading, saving and applying changes to ontologies. An OWLOntologyManager can be configured with different factories and storers so that different concrete representations of ontologies can be obtained an manipulated. A 'standard' instance of OWLOntologyManager, which is configured with the usually required parsers etc. can be obtained using the OWLManager class:
Ontologies
Ontologies are represented by the OWLOntology interface. Every ontology has a URI which identifies and acts as the name of the ontology. As stated previously, ontologies are viewed as a collection of axioms. It should be noted that ontologies don't directly 'contain' classes, properties and individuals - the axioms that the ontology contains, merely reference these entities.
Ontology URI vs. Physicial URI (URL)
Ontologies are named using URIs - ontologies can be retrieved from URLs. This has the potential to cause confusion. There is no requirement for an ontology to have a URI which corresponds to a URL that can be resolved in order to obtain a representation of the ontology. For this reason, the OWL API does not make any assumption about the location of an ontology based on its URI. The OWL API simply treats the URI of an ontology as an 'opaque' string, which provides a unique name for the ontology. In order to obtain a representation of an ontology, the OWL API uses implementations of the OWLOntologyURIMapper interface. This simple interface takes an ontology URI and in return provides a physical URI which can be interpreted to obtain a representation of the ontology. Ontology URI mappers are registered with an OWLOntologyManager before an ontology is loaded or created. Some implementations of OWLOntologyURIMapper are provided such as the SimpleURIMapper, CommonBaseURIMapper, and AutoURIMapper.
Creating and loading ontologies
Instances of OWLOntology can be obtained via an OWLOntologyManager by either creating an empty OWLOntology or by loading an existing OWLOntology. Examples 1 and 2 on the documentation page provide detailed examples on how to load, save and create ontologies.
Entities
An entity is essentially a named object. The OWL API makes a distinction of five types of entities - classes, object properties, data properties, individuals and datatypes. The following interfaces represent these entities:
- OWLClass - represents named classes for example, Person, Cat, Car. Classes are interpreted as sets of individuals.
- OWLObjectProperty - represents object properties which link individuals to individuals, for example hasPart, hasParent.
- OWLDataProperty - represents data properties which link individuals to data values, for example hasAge, hasSocialSecurityNumber.
- OWLIndividual - represents individuals or 'objects'. An individual can have a name (it's URI), or can be anonymous.
- OWLDataType - represents a named datatype (e.g. int, float, string etc.)
The diagram below represents the part of the OWL API interface hierarchy that represents these entities.

Listing entities in an ontology
The entities in an ontology can be listed in the following way:
OWLOntology ont; // Assume reference to ontology is obtained
for(OWLClass cls : ont.getReferencedClasses()) {
System.out.println(cls);
}
Adding and removing entities from ontologies
Entities cannot be directly added or removed from ontologies. Entities are 'added to ontologies' when axioms that reference the entity are added to an ontology, and entities are 'removed' or 'deleted' from an ontology when all axioms that reference the entity are removed from the ontology. Example 5 shows how to 'delete' entities from an ontology.Class Descriptions
Class descriptions are used in axioms and constitute the basic building blocks of ontologies. There are two main types of class descriptions: Named classes (represented by the OWLClass interface) and Anonymous classes (which extend the OWLAnonymousDescription interface). In both cases, class descriptions are interpreted as sets of individuals.