Skip to : [Content] [Navigation]
 

How can I use Pellet with OWL-API?

Pellet implements various reasoner interfaces provided in the OWL-API. You can create a Pellet reasoner and then use it as any other reasoner:

// import org.mindswap.pellet.owlapi.Reasoner

// create an ontology manager
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

// create the Pellet reasoner
Reasoner reasoner = new Reasoner( manager );

// ontology that will be used
String file = "http://www.mindswap.org/2004/owl/mindswappers";

// Load the ontology 
OWLOntology ontology = manager.loadOntology( URI.create( file ) );
reasoner.loadOntology( ontology );

// get the instances of a class
URI PersonURI = URI.create( "http://xmlns.com/foaf/0.1/Person" );
OWLClass Person = manager.getOWLDataFactory().getOWLClass( PersonURI );   
Set instances  = reasoner.getInstances( Person, false );

Pellet 1.5 uses a newer snapshot of OWL-API including support for OWL 1.1, built from development sources. See version.txt included with OWL-API in the Pellet source tree for details on obtaining the source for this revision of OWL-API.

OWL-API is under rapid development and the best source of documentation, including general examples, is likely to be the project page at SourceForge