OWL, Pellet, Jena

Consider that your ontology is structured similar to the following:

However, consider also that you only want to select EventTriggers which eventually NavigateWire to a Page. Through OWL 1.1 this can be achieved through property chaining. We will eventually end up with a new object property called eventToPage:

First, load up your initial ontology and create a new ontology for your extensions. This can be done in Protege: OWL Validation with Jena.

Inspired by this discussion, we are going to add a property isPage which can only exist (and will only exist) for instances of Page. Create a new object property “isPage”, and to the definition of “Page”, add a subclass “isPage some owl:Thing”. Thanks to the open world assumption, all instances of “Page” must therefore contain this property.

We then add a property “toPage” which is a “to” property that points to a “Page”. This is where it gets a little hacky. In Protege, we specify the domain as WireEdge, the range as Page, and define the property chain as the following. The o is the actual letter “o”, but do not enter in the “-> toPage” (this is added automatically).

to o isPage o inv(isPage) -> toPage

Finally, we define an “eventToPage” property, which is all “outEdges” that connect to a “toPage”.

outEdges o toPage -> eventToPage

To check that instances of this is actually being created, you can query the Jena API like so: (More code forthcoming.)

OntModel schema = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC );
schema.read(<source.owl>, null);
schema.read(<extension.owl>, null);

Reasoner reasoner = PelletReasonerFactory.theInstance().create().bindSchema(schema);
Model model = FileManager.get().loadModel("file:" + rdf);
InfModel inf = ModelFactory.createInfModel(reasoner, model);

Property index = inf.getProperty("http://openiaml.org/verification/2009/infiniteRedirect.owl#eventToPage");
Iterator<Statement> it = inf.listStatements(null, index, (RDFNode) null);
while (it.hasNext()) {
  Statement s = it.next();
  System.out.println(PrintUtil.print(s));
}

If you are not getting any results, make sure that Protege has not mangled up your namespaces; edit the OWL file manually and check that all property references are pointing to the correct URIs.