Documentation

Ignazio Palmisano edited this page Apr 23, 2017 · 15 revisions

Javadoc

Javadoc for the API is available online and included in the distribution - also available on Maven Central.

HOWTO

In order to use the API in your own applications, you should download the latest binary release and ensure that all of the jar files are in the application classpath.

To do so, we strongly recommend you use a dependency management tool; for example you can use Maven. A Maven dependency (this example is for 5.1.0, most recent release for version 5)

<dependency>
    <groupId>net.sourceforge.owlapi</groupId>
    <artifactId>owlapi-distribution</artifactId>
    <version>5.1.0</version>
</dependency>

Java version: 8 or newer.

OWL API 5.x requires Java 8. OWLAPI 4.x requires Java 7. OWL API 3.5.x requires Java 6. All are compiled and tested on Oracle JDK 8.

Build your own

If you want to check out the source code and build the binaries yourself using Maven.

Programming with the OWL API

The central point of access is the OWLOntologyManager, which is used to load, create and access ontologies. The examples below show how to create an instance of this class and how to use it.

Code examples

  1. How to load an ontology.
  2. How to save an ontology.
  3. How to obtain references to entities (classes, properties, individuals etc.).
  4. How to work with data types and other data ranges.
  5. How to work with user defined data ranges (e.g. int > 10).
  6. How to work with string, data values and language tags.
  7. How to create an empty ontology, add axioms and save.
  8. How to specify that an individual is an instance of a class.
  9. How to specify that two individuals are related to each other.
  10. How to add an object property assertion (triple) to an ontology.
  11. How to delete entities (classes, properties and individuals) from an ontology.
  12. How to create restrictions and ''add them to classes'' as superclasses.
  13. How to create an ontology and add some rules.
  14. How to interact with a reasoner.
  15. How to collect the properties that are used in restrictions on a given class.
  16. How to work with annotations such as labels and comments.
  17. How to save *inferred axioms into a new ontology, or back into an existing ontology.
  18. How two (or more) ontologies can be merged in a simple way.
  19. How to 'walk' over the asserted structure of an ontology.
  20. How to use OWLOntologyIRIMapper to redirect loading and loading of imports.
  21. How to extract a locality based module from an ontology.

More Code Examples

Simple Hierarchy

This example for version 3.x and example for version 4 show how we can calculate and display a basic ontology hierarchy. The example makes use of an OWLReasoner to calculate the class hierarchy, then navigates the structure obtained, printing out basic information for each of the classes. The example uses a StructuralReasoner, which returns information about the hierarchy based solely on the assertions that are made in the ontology.

Rendering example

This example for 3.x and example for 4 show the definition of a simple renderer. The renderer provided an HTML page describing the entities in the ontology.

Closure Axioms

This example for 3.x and example for 4 illustrates manipulation of axioms in an ontology.

Debugging

This example for 3.x and example for 4 illustrate the use of the debugger. The debugger identifies axioms causing inconsistencies in OWL ontologies.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.