1. Annotating closed classes and properties
An NBox (Negation As Failure Box, see the Publication page for details) is a set of classes and object properties, whose extensions are closed. Full negation in front of closed classes functions as Negation as Failure. In other words, if an individual is not inferred to be an instance(s) of a closed class, then it is regarded as an instance of the negation of that closed class.
To specify which class/property names to be closed in an OWL ontology, we use the annotation property http://trowl.eu/REL#NBox. With OWL API, one can annotate predicates with the following code, in which cls is the class to be closed:
OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create("http://TrOWL.eu/REL#NBox"));
OWLAnnotation annotation = factory.getOWLAnnotation(property, factory.getOWLLiteral("close", "en"));
OWLAxiom axiom = factory.getOWLAnnotationAssertionAxiom(cls.getIRI(), annotation);
manager.applyChange(new AddAxiom(ontology, axiom));
2. Load and reason with an OWL 2 DL ontology with NBox
If classes and properties are closed with the above mentioned annotation property http://TrOWL.eu/REL#NBox with value “close@eu”, then TrOWL will automatically detect the NBox and perform local closed world reasoning after loading the ontology. You do not need to write extra code.
Alternatively, you can also close classes and properties in the run-time without specifying in the ontology. After loading the ontology, one can use the following method to close a set of class names and/or a set of property names. When calling this method, closed world reasoning will be performed w.r.t. the specified NBox.
RELReasoner.close(Set classes, Set properties)