Skip to : [Content] [Navigation]
 
Fork me on GitHub

How can I use Pellet with Jena?

There are two different ways to use Pellet in a Jena program: either using direct Pellet interface (highly recommended); or using Jena DIG interface (not recommended). The Direct Pellet interface is much more efficient (e.g. does not have the HTTP communication overhead) and provides more inferences (DIG protocol has some limitations). Using the direct interface is not any different than any other Jena reasoner:

// ontology that will be used
String ont = "http://www.mindswap.org/2004/owl/mindswappers";
        
// create an empty ontology model using Pellet spec
OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC );   
            
// read the file
model.read( ont );
               
// get the instances of a class
OntClass Person = model.getOntClass( "http://xmlns.com/foaf/0.1/Person" );         
Iterator instances = Person.listInstances();

See the examples directory in the Pellet distribution for more examples.