5.3 Demonstrating OWL Inference
 |
There are three levels of inference to consider: no inference, RDFS, and the OWL inference provided by Pellet. |
 |
The applications use various inference levels in action on the knowledge model we just went through. |
 |
The application takes four parameters: an input file, the input file format (N3, RDF/XML, N-Triple, or Turtle), an output file, and the inference level (none, rdfs, or owl). When it runs, |
|
 |
It loads the input file into a Jena model and applies the specified inference level to the knowledge model. |
|
 |
Then it prints a summary of each individual and those statements in the model that describe it. |
|
 |
The application takes an input ontology and outputs the individuals in the knowledge model, including any statements about them, after one of the three inference levels has been applied. |
|
 |
The first thing the application does is extract the parameters from the arguments to the main() method. |
|
 |
Next, it creates an input stream for the input file and a print writer for the output file. Once all the setup is complete, the interesting part begins. |
|
 |
Depending on the inference mode, the application creates the Jena OntModel in one of three ways. |
|
 |
Finally, after creating the model in one of the three ways, we load the ontology into the model using model.read(...). |
|
 |
Inference occurs automatically, so no explicit action has to be taken to ensure that entailments are derived. |
|
 |
The final part of the application involves iterating over the list of all individuals in the model, and printing them and all statements for which they are the subject in a summary form to the output file. |