-
Notifications
You must be signed in to change notification settings - Fork 315
Documentation
Javadoc for the API is available online and included in the distribution.
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.
Alternatively, use a Maven dependency
(this example is for 3.4.5)
<dependency> <groupId>net.sourceforge.owlapi</groupId> <artifactId>owlapi-distribution</artifactId> <version>3.4.5</version> </dependency>
The latest OWL API requires Java 6 or newer. It has been compiled and tested on Oracle JDK 7. If you find it not working on any JRE 6 or newer, please let us know in the bug section.
If you want to check out the source code and build the binaries yourself, you can either use ANT (build file is in the antbuild folder) or Maven. Maven is the build system currently used for official builds, and it includes OSGI compatibility in the builds (experimental feature).
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.
- The Rough Guide to the OWL API, a tutorial presented at OWLED 2011.
- Source code for The Rough Guide to the OWL API (includes most of the code available in the subsequent examples).
- DL Query Example presents an example of how to query an ontology.
- Examples include:
- How to load an ontology.
- How to save an ontology.
- How to obtain references to entities (classes, properties, individuals etc.).
- How to work with data types and other data ranges.
- How to work with user defined data ranges (e.g. int > 10).
- How to work with string, data values and language tags.
- How to create an empty ontology, add axioms and save.
- How to specify that an individual is an instance of a class.
- How to specify that two individuals are related to each other.
- How to add an object property assertion (triple) to an ontology.
- How to delete entities (classes, properties and individuals) from an ontology.
- How to create restrictions and ''add them to classes'' as superclasses.
- How to create an ontology and add some rules.
- How to interact with a reasoner.
- How to collect the properties that are used in restrictions on a given class.
- How to work with annotations such as labels and comments.
- How to save *inferred axioms into a new ontology, or back into an existing ontology.
- How two (or more) ontologies can be merged in a simple way.
- How to 'walk' over the asserted structure of an ontology.
- How to use
OWLOntologyIRIMapper
to redirect loading and loading of imports. - How to extract a locality based module from an ontology.
This example shows 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.
This example shows the definition of a simple renderer. The renderer provided an HTML page describing the entities in the ontology.
This example illustrates manipulation of axioms in an ontology.
This example illustrates the use of the debugger. The debugger identifies axioms causing inconsistencies in OWL ontologies.